List:General Discussion« Previous MessageNext Message »
From:Steven Staples Date:March 19 2012 5:33pm
Subject:RE: Group_Concat help...
View as plain text  
> -----Original Message-----
> From: Mihail Manolov [mailto:mihail.manolov@stripped]
> Sent: March 19, 2012 12:44 PM
> To: Steven Staples
> Cc: <mysql@stripped>
> Subject: Re: Group_Concat help...
> 
> Try this
> 
> SELECT `user_id`, `login_ip`,
> COUNT(`id`) AS 'connections'
> FROM `mysql_test`
> WHERE `login_datetime` BETWEEN '2012-03-19 00:00:00' AND '2012-03-19
> 23:59:59'
> GROUP BY `user_id`, `login_ip`
> HAVING COUNT(`id`) > 2
> ORDER BY COUNT(`id`) DESC
> LIMIT 0, 15;
> 
> On Mar 19, 2012, at 12:06 PM, Steven Staples wrote:
> 
> > SELECT `user_id`, GROUP_CONCAT(DISTINCT `login_ip`) AS 'login_ips',
> > COUNT(`id`) AS 'connections'
> > FROM `mysql_test`
> > WHERE `login_datetime` BETWEEN '2012-03-19 00:00:00' AND '2012-03-19
> > 23:59:59'
> > GROUP BY `user_id`
> > HAVING COUNT(`id`) > 2
> > ORDER BY COUNT(`id`) DESC
> > LIMIT 0, 15;
> 

Thanks for the reply Mihail.
I was initially doing it that way, but if you look at the example of what I
wanted as a reply, it doesn't work.
I was hoping for a result that I could just plop into the PHP code, and I
wouldn't have to manipulate it at all, but so far, it looks like I am going
to have to do that... unless anyone else here has another idea... 

Thread
Group_Concat help... Steven Staples19 Mar
  • Re: Group_Concat help... Mihail Manolov19 Mar
    • RE: Group_Concat help... Steven Staples19 Mar
  • Re: Group_Concat help... hsv19 Mar