lol

sorry I should have expained context a bit before asking ...
From member table (mmbnumbm*, mmbnamem, joindatem...)
and rental table (mmbnumbm*(FK), rentaldatem*, tpnumbm*(FK),...)
I'm querying for a report that will list mmbnumbm, mmbnamem for 'dormant accounts'. 'dormant' meaning no activity within the past year --refering to those mmbnumbms in the rental table where "today - rental.rentaldatem is > 1 year", and no outstanding rentals.
This coresponded to the first part of the query (above).
However, I also must include all members whose mmbnumbm is not in the rental table (because they never had any activity (rentals) since joining), and whose joindatem is more than a year ago. This is meant to corespond to the second part of the query (above).
BUT, I did eventually get it to give me the results I needed (altough I'm quite positive it is not the best/most efficient way). For the sake of it, this is what I came up with:
Code:
SELECT mmembera.mmbnumbm, mmembera.mmbnamem, mmembera.mmbphonem
FROM mmembera
WHERE (datediff(day, mmembera.joindatem, today()) > 365) AND
mmembera.mmbnumbm NOT IN
(SELECT mrentala.mmbnumbm
FROM mrentala
WHERE mmbnumbm = mmembera.mmbnumbm)
UNION
SELECT mrentala.mmbnumbm, mmembera.mmbnamem, mmembera.mmbphonem
FROM mrentala, mmembera
WHERE mrentala.mmbnumbm = mmembera.mmbnumbm AND
(datediff(day, mrentala.daterentedm, today()) > 365) AND
(mrentala.returndatem IS NOT NULL)
Anyways, thanks a lot Rudy for your input though --MUCH APPRECIATED!
Mark