View Full Version : compare records?


qwkslvr1999
01-21-2002, 11:36 AM
I have a table that looks like this:

SID Field2
1 1
1 1
1 2
2 1
2 1
3 2
3 3
3 1
4 1
5 2
5 2

My problem is, I want to get the SID if and only if its value in all occurences is 1, regardless of how many times it appears in the table. So, for my sample table, the result SIDs should be, 2 and 4.

I hope somebody can help me with this one. Thanks!

KKilfoil
01-21-2002, 11:48 AM
How about creating a summary query to find the min and max of Field2 , grouped by SID, and then a separate select query based on yourtable and above query with a criterion of min=1 AND max=1

qwkslvr1999
01-22-2002, 06:24 AM
I never thought of that! I tried it and it absolutely worked! Thank you very much!