I am trying to solve the following: the data is organized in a table with column X as a foreign key for the information (this is an identifier that identifies the set of rows in this table as belonging together in a set, belonging to a specific object in another table). Therefore, each individual value of X has several lines associated with it here. I would like to filter out all the different X values ββthat have a row associated with them containing the value "ABC" in column Q.
i.e.
The data is as follows:
Column X Column Q -------- --------- 123 ABC 123 AAA 123 ANQ 456 ANQ 456 PKR 579 AAA 579 XYZ 886 ABC
the query should return "456" and "579" because these two different X values ββdo not have rows containing the value "ABC" in column Q.
I thought about this with a minus function (choose a great X minus (choose a great X, where Q = "ABC"), since all I want are different values ββof X. But I was wondering, a more efficient way to do this, to avoid a subquery? If, for example, I could split the table into X and throw out each section that had a row with the value "ABC" in Q?
source share