View Full Version : Help with query...


Myriad_Rocker
11-05-2004, 08:38 AM
I'm not using Access for this but I figured this was a good place to help iron out my logic. I can do the SQL from there....

I have attached an example of the data that I'm getting from my current query. It's in Excel. What I want to do, is find out if ANYONE (noted by their ID number) is missing a spouse or a child in their plan. As you can see, everyone has at least one of these. So, my output would be numbers 4 and 5 because they are missing one.

How would the logic work on this?

Myriad_Rocker
11-05-2004, 08:40 AM
Forgot the file...

Jon K
11-05-2004, 10:17 AM
SELECT ID
FROM tblData
GROUP BY ID
HAVING Sum(IIF(Enrolled="Spouse",100,1))<101;


The logic behind the query: If Spouse=100 and a Child=1, then Spouse and one child would be 101, so any ID below 101 would miss either the Spouse or a child.
.