php - MYSQL GROUP BY not grouping -


hi trying group results visit_id, doesn't seem work.

here code.

  select url1 pages group visit_id order timedate 

here database structure

 id` int(10) not null auto_increment, `client_id` int(11) not null, `url` text not null, `time` timestamp not null default current_timestamp on update current_timestamp, `timedate` datetime not null, `visit_id` varchar(100) not null, `url1` varchar(255) not null, `page_time` time not null 

the code works doesn't seem group id

this guess. guess want url1 given visit_id "grouped" together. if so, use group_concat():

select visit_id, group_concat(url1 separator ', ' order timedate) pages group visit_id 

i included visit_id in select clause can see visit corresponds pages. if want unique list, use group_concat(distinct url1 . . .).


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -