Mysql
on a simple table (all integers)
A B C
I want to query all rows where C is a distinct number or 0
for example:
0 1 4
4 5 6
6 5 0
5 6 0
7 5 4
8 5 6
9 5 0
Should give:
0 1 4
4 5 6
6 5 0
5 6 0
9 5 0
rows:
7 5 4
8 5 6
didnt match because in col C 4 and 6 already appear.
All the C=0 columns should appear.
Whats the best way to do a query that does distinct C or C=0 ?
the results order doesn't matter.
Best Answer
Try this:
The caveat here is that you have no control on which row will be returned from each set of rows that have the same values of "C"