Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ORDER BY ALIAS?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Who can tell me why this query won't work:

SELECT stimm_photo_nr, COUNT(*) AS TotalStimmen
FROM stimmen
GROUP BY stimm_photo_nr
ORDER BY TotalStimmen

Thanks a lot!
 
I don't think you can reference the alias in the order by clause. As a simple work-around, try referencing by position:

SELECT stimm_photo_nr, COUNT(*) AS TotalStimmen
FROM stimmen
GROUP BY stimm_photo_nr
ORDER BY 2
 
Thanks Karluk,

I've tried it and it works, I'm very grateful!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top