i have the following tables:
table1
ID
Stat
table2
ID
Date
I need to display all items in table1 with a Stat of 5, 10 or 20 with their associated Date from table2, BUT if the Stat from table1 is equal to 10, then I need to check whether the associated Date from table2 is equal to 02/04/2007…if so, I need those records also NOT displayed.
SELECT a.Stat, b.Date FROM table1 as a, table2 as b WHERE a.Stat IN (5,10,20)
That’s where I get stuck though…how do I tell the query that IF now the Stat we found is 10, also check the date from table2 and if that date is equal to 02/04/2007, take it out of the record display too?