I am wrangling with a query pulling unique values from 3 tables. Is this better done in 2 separate queries?
the query is to:
count as returned (
all leadID from lds where status = "ok"
AND leadID is also in rlds with recID="999"
AND rdate > (03-20-2012)
+
(all distinct leadID from plds where recID="999"
AND change != NULL
AND pdate > (03-20-2012))
the result of the working query should be “2”: leadID 1 and leadID 4
table lds:
leadID | status
1 | ok
2 | bad
3 | ok
table plds:
leadID | recID | change | pdate
4 | 999 | ch1 | 03-27-2012
4 | 999 | ch2 | 03-27-2012
5 | 888 | NULL | 03-27-2012
table rlds:
leadID | recID2 | rdate
1 | 999 | 03-27-2012
6 | 999 | 03-27-2012
Thanks!
1 Answer