Ah...
you can name the count()..
live and learn, cheers dude...



"brett king" <[EMAIL PROTECTED]> 
15/01/2004 11:17
Please respond to
<[EMAIL PROTECTED]>


To
<[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
cc

Subject
RE: [PHP-DB] SQL query...






"SELECT DISTINCT(file_name), Count(file_name) FROM $table_name WHERE date
BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by ???????
desc"

In the above sql statement, I'm trying to achieve:

1. select all file names, between two dates.
2. list them, and order by the highest number of occurences of count()

Basically, it's for a download tool we have, and my boss wants to easily
be able to see the top downloaded files.
It all works, but not the 'order by' bit... what do I have to order by...
it's not 'file_name', and 'order by count(file_name0' causes an error...

thoughts?

Cheers,
Tris...

-----------------------------------------

can you not do this?

"SELECT DISTINCT(file_name), Count(file_name)fcount FROM $table_name WHERE
date
BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by fcount
desc"

Please note that I have named count(file_name) fcount in the sql statement

Hope this helps?

Brett

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




*********************************************************************
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***********************************************************************

Reply via email to