Jump to content

[SOLVED] using GROUP BY syntax in mysql_query


dsaba

Recommended Posts

I know this has to do with group by syntax, but its giving me errors

 

$mostever_query = mysql_query("SELECT * COUNT(*) as howmany FROM online GROUP BY date WHERE url='$url' ORDER BY howmany DESC LIMIT 0, 1") or die(mysql_error());

 

I have a table called 'online'

i have 2 fields called 'date' and 'url'

 

All I want to do is find the date that occurs the most in the 'online' table where url='$url'

and get a number of how many times it occurs in the table

 

How can I do this? What am I doing wrong in my query?

 

it errors like this:

(You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COUNT(*) as howmany FROM online GROUP BY date WHERE url='/p2m-tr)

 

thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.