|
Posted by rukkie on 12/19/06 14:34
Some addition :
the commands used in PHP to see the result are :
while($nt=mysql_fetch_array($result5)){
if ($nt[col1] <> "") {
echo $nt[col1] ."\n <br>";}
if ($nt[col2] <> "") {
echo $nt[col2] ."\n <br>";}
}
As a result I fsee some double entries, which is not the idea .... Very
strange behaviour or very stupid programming of me ?
rukkie schreef:
> 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 !!
Navigation:
[Reply to this message]
|