Count and order by - error

  • Thread starter Thread starter SpookiePower
  • Start date Start date
S

SpookiePower

I'm trying to count how many time
each user have been logged in to my website
and then sort them desc. But I keep getting
an error.

SELECT user, count(user) AS logins
FROM tsigninlog
GROUP BY user
order by logins desc;

This SQL shows a form where I must enter a parameter value.
Why does it not works ?
 
There is no field called logins. logins doesn't exist until after the
query is executed. Therefore your order by column should be
count(user).

Cheers,
Jason Lepack
 
Jason said:
There is no field called logins. logins doesn't exist until after the
query is executed. Therefore your order by column should be
count(user).

Cheers,
Jason Lepack

Thanks. It works now :)
 
Back
Top