spirit1,How can it work when the parameter is in a nested select statement. I will try to shorten the query:SELECT d.depositid FROM tbldeposit d WHERE NOT EXISTS ( SELECT distinct A.depositid FROM tblAccountTransaction T INNER JOIN tblAccount A ON A.[AccountId] = T.[AccountId] WHERE D.depositid = A.depositid AND T.transactiondate BETWEEN isNull('2003-02-18',(SELECT MIN(OrderDate) FROM tblclientorder)) AND isNull('2008-03-25', (SELECT MAX(OrderDate) FROM tblclientorder)) ) UNION ( SELECT d.depositid FROM tbldeposit d WHERE NOT EXISTS (SELECT distinct depositid FROM tblclientorder co WHERE d.depositid = co.depositid AND co.orderdate BETWEEN isNull('2003-02-18',(SELECT MIN(OrderDate) FROM tblclientorder)) AND isNull('2008-03-25', (SELECT MAX(OrderDate) FROM tblclientorder)) ) )The following dates should be possible to change to whatever date: '2003-02-18' and '2008-03-25'How is it possible if I make a view called x out of the above select-statement and afterwards try to select the view with respect to a "where" for the dates ?Select * from view x where ??Any ideas?