| Posted by rukkie on 12/19/06 12:12 
Hi,
 I have a MySql database in which I have 2  columns of which I want to
 make a list of all the distinct values from both columns. The 2nd
 column can be empty if the first one is filled in ; if the 1st column
 is filled in, then the 2nd column is by default also empty.Also the
 distinct values should be in alphabetical order
 
 I'm using this query :
 
 $query5="SELECT DISTINCT col1,col2 FROM db WHERE (col1<>\" \") ORDER BY
 col1,col2 asc";
 
 But this is not working at all ... I got double entries and the list is
 not correctly sorted ...
 
 Has anyone out there some idea on how to get a sorted list of only the
 distinct values of both columns ?
 
 A newbie should be very happy with it ...
 
 Thanks in advance !!
 [Back to original message] |