Hello Christopher,

Friday, July 11, 2003, 6:31:33 PM, you wrote:

First select:

The results are just right what you want in your SELECT.
You have 5 different values in COLUMN1 and your select returns them.
>From second column SELECT gets first value for each value of first
column.

Second select:
It works correct too. The data in yor excample are 9 records total.
To have grouping you must have equal values in columns wich you
incuded in group-criteria.
You have only 2 records wich have the same values in grouping
criteria...so they are grouped. The rest records are different. So
it's normall second SQL to return 8 record.

I don't know what is  the main job anyway. But, if you want to exclude
some records you can use WHERE clause for example.



CK> Im having troubles getting the results I want... can someone suggest which way to 
go..
CK> mysql 4.0

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

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

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

CK> Ive tried 

CK>         select * from table group by 1stcolumn = (unpredicatble results, but 
returns 5 rows)

The results are just right what you want in your SELECT.
You have 5 different values in COLUMN1 and your select returns them.
>From second column SELECT gets first value for each value of first
column.



CK>         select * from talbe groub by 1stcolumn, 2ndcolumn = (returns 8 rows)

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






-- 
Best regards,
 Krasimir_Slaveykov                            mailto:[EMAIL PROTECTED]
Tel: ++359 2 97 666                                 [EMAIL PROTECTED]
Tel: ++359 2 97 66 701
Fax: ++359 2 97 66 731


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to