[thelist] SQL Query : using Group By and Order By together

rudy r937 at interlog.com
Tue Jan 8 22:11:19 CST 2002


my apologies if this comes through twice -- mail problems continue


>   SELECT aplink, aplogo, apname, aptime
>        FROM $aptable
>     GROUP BY aplogo
>  ORDER BY aptime DESC

this is still not valid

the GROUP BY and SELECT are different, and that's not allowed

> When I look at the mysql table, using phpmyadmin which doesn't order the
> table in anyway, I can see this 21esite entry in third position, although
> the primary key (automatic incrementing counter) is 53..

alliax, rows in a database table do not have a "position", and the table
does not have a "natural" order

please, run the query *without* a group by and *without* an order by

i'd like to see what the actual data looks like

paste the query results into microsoft excel or the equivalent, then sort
them yourself into whatever order you want, then paste the sorted results
here

then ask your question again

;o)

rudy






More information about the thelist mailing list