samedi 9 mai 2015

SQL Query Help - Explanation Below

Stuck on how to query this result set.

A       B       C
162     0       NULL
162     1       NULL
162     2       NULL
163     0       000
163     1       000
163     2       000
164     0       000
164     1       NULL
164     2       NULL

I want to show only these results

A       B       C
162     0       NULL
162     1       NULL
162     2       NULL
164     0       000
164     1       NULL
164     2       NULL

I do not want to return results if all of an unique instance of column A has a value. So, in this example the new result set has removed 163 from the result set as all rows containing 163 had a value (Which was 000). The others show because one instance of the row contains NULL, and all rows unique to it should display.

I did try nested queries and playing around with GROUP BY, but haven't been able to crack it.

Any advice?

Thank you.

Aucun commentaire:

Enregistrer un commentaire