Subject Re: [ib-support] Looking for help with query and SINGULAR
Author Svein Erling Tysvaer
>Anyway, I thought the following would work:
>
>SELECT * FROM Media WHERE MAction = 2
>AND NOT EXISTS (SELECT * FROM Media WHERE MAction = 1)

That's very close, Dan, but it checks that there exists no record in the
entire table with MAction = 1. Change your code to

SELECT * FROM Media M WHERE MAction = 2
AND NOT EXISTS (SELECT * FROM Media M2 WHERE M2.MAction = 1 and M2.MStoreId
= M.MStoreId)

and it should return what you want.

Set