I am trying to run this sql statement:
Code:
SELECT min(distinct(a.id)) FROM TBL_NOTEBOOK AS a WHERE Item_Type=1 
AND a.id<>(SELECT d.id FROM tbl_notebook as d inner join tbl_checkout 
as e on e.item_id=d.id  WHERE (d.item_type=1)  AND (e.returned=0)AND
(((@date1>=e.date_out_res) AND (@date2>=e.date_out_res)) OR 
((@date1<=e.date_in_res) AND (@date2<=e.date_in_res))))
The problem occurs when the imbedded select returns nothing then the final result is null. Is there any way to prevent that?