List:General Discussion« Previous MessageNext Message »
From:Christopher Knight Date:July 11 2003 3:31pm
Subject:grouping / sorting etc..
View as plain text  
Im having troubles getting the results I want... can someone suggest which way to go..
mysql 4.0

A
------------
| 1 |      |
| 1 | BAD  |
| 2 |      |
| 3 | BAD  |
| 3 |      |
| 4 | BAD  |
| 5 |      |
| 5 | BAD  |
| 5 | BAD  |
------------

what I want is 5 results.  If there is a NULL, then return the NULL, else return the BAD

so basically return ...
------------
| 1 |      |
| 2 |      |
| 3 | BAD  |
| 4 | BAD  |
| 5 |      |
------------

Ive tried 

	select * from table group by 1stcolumn = (unpredicatble results, but returns 5 rows)
	select * from talbe groub by 1stcolumn, 2ndcolumn = (returns 8 rows)

I could do the 2nd way then filter out w/ the code...
Is there a better way?
Thanks
Chris

Thread
grouping / sorting etc..Christopher Knight11 Jul
  • Re: grouping / sorting etc..Krasimir_Slaveykov14 Jul
RE: grouping / sorting etc..Rudy Metzger14 Jul
  • RE: grouping / sorting etc..Christopher Knight14 Jul