>>>I have a table that looks something like this:
>>>
>>>
>>>groupnum itemnum quantity
>>>1 10 1
>>>2 10 1
>>>1 17 5
>>>2 17 5
>>>1 23 2
>>>1 26 1
>>>2 26 1
>>>1 27 3
>>>2 27 4
>>>1 30 0
>>>2 30 0
>>>2 33 1
>>>1 36 3
>>>2 36 5
>>>
>>>
>>>The table isn't really sorted, but we order it this way in queries. As you can see, most itemnums are found in groups 1 and 2, and usually have the same quantity. The user wants a query that returns those itemnums found in both groups, but with different quantities. In the above example, such a query would return:
>>>
>>>
>>>1 27 3
>>>2 27 4
>>>1 36 3
>>>2 36 5
>>>
>>>There are probably a few ways to do this, involving sequences of queries, but I wonder what would be the most efficient.
>>Why would
>>1 17 5
>>2 17 5
not included ?
>>Cetin
>
>I'm not sure if I understand your reply. The purpose of the query is to select pairs where the itemnum is the same, but the quantity is different for groupnum 1 and 2.
"But with different quantities" was the point I missed. Evan already gave the solution.
Cetin