Reputation: 125
I have the following table with the some sample data:
|| Filename || receiving_site || originating_site ||
| fileA | siteA | HQ |
| fileA | siteA | siteA |
| fileB | siteA | HQ |
| fileA | siteB | HQ |
| fileA | siteB | siteB |
| fileB | siteB | HQ |
| fileB | siteB | siteB |
The table works in such way:
My task is to list out all the "Filename" per "receiving_site" that has been sent, but not received yet by the "receiving_site". For example from the sample data above, I am expecting to see that siteA, fileB has not been received yet.
How can I do that? I had tried MINUS and NOT EXISTS command, but I am just not able to get the result that I want.
Upvotes: 0
Views: 78
Reputation: 16915
(select filename, receiving_site
from yourTable)
minus
(select filename, receiving_site
from yourTable
where receiving_site = originating_site)
all the data without the ones that were received
Upvotes: 1