GROUP_CONCAT query
| From: | I.A. Gray | Date: | Fri, 11 Jun 2004 11:33:07 +0000 |
| Subject: | GROUP_CONCAT query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-34736@lists.php.net to get a copy of this message | ||
Hi all,
I sometimes find the MYSQL manual very difficult to understand- perhaps I am
alone in this. I am wanting to do the following, and I think I need to use
GROUP_CONCAT in my query.
I have a table of webstats for my site with columns for IP, Hostname,
referer website etc and I want to show the occurences of the the same IP,
hostname and referer website and how many times.
How do I do this? My normal query would look like this?
$query = "SELECT
id , clicks , os , browser
, ip , port , host
, country_code , country_name , cookies ,
crawler ,
referer_website , qs , datestart , dateend ,
timestart , timeend
, history , fulltimestart , daystart ,
fulltimeend , dayend ,
timelength
FROM webstatstable"
I have tried doing SELECT referer_website, GROUP_CONCAT(referer_website)
FROM 'webstatstable' but that doesn't seem to work. Any ideas?