I'm sticking to SQL because this forum is about ISO/ANSI SQL and not some other syntax used by some products...
If you want to have all records "VE if depart before 10 march as well as all that have az if depart before 17 march", you'd have a query like this:
Code:
SELECT *
FROM ...
WHERE ( b.shipcode = 'VE' AND
b.departuredate < '10-Mar-2012' ) OR
( b.shipcode = 'AZ' AND
b.departuredate < '17-Mar-2012' )
The way you wrote it above:
Code:
[ Sqle = Sqle & " and b.shipcode = 'VE' and b.departuredate < '10-Mar-2012'"
Sqle = Sqle & " and b.shipcode = 'AZ' and b.departuredate < '17-Mar-2012'" ]
cannot work because you have two predicates "b.shipcode = 'VE' AND b.shipcode = 'AZ'" which are mutually exclusive - if one would evaluate to true for a row, the other would evaluate to false so that the ANDing of both predicates is always false.