JipThePeople Posted November 30, 2010 Share Posted November 30, 2010 Wanting to add ORDER BY to sort items grouped as a result of the GROUP_CONCAT. Any recommendations? SELECT `t1`.`id`, `t1`.`filename`, `t2`.`process`, `t3`.`folder_name`, `t3`.`userid` AS `folder_userid`, `t1`.`inout`, `t1`.`userid`, `t1`.`last_updated`, `t1`.`filesize`, `t1`.`pagecount`, GROUP_CONCAT(`t4`.`comment` SEPARATOR ' | ') AS `concat_comments` FROM (`proposal_files` AS `t1` JOIN `prop_file_processes` AS `t2` ON `t1`.`process` = `t2`.`id`) JOIN `folders` AS `t3` ON `t1`.`folder` = `t3`.`id` LEFT JOIN `prop_file_version_comments` AS `t4` ON `t1`.`id` = `t4`.`fileid` WHERE `t1`.`propid` = " . sql_quote($_SESSION['current_prop_id']) Quote Link to comment https://forums.phpfreaks.com/topic/220270-how-do-i-use-group_concat-with-order-by/ Share on other sites More sharing options...
requinix Posted November 30, 2010 Share Posted November 30, 2010 The documentation is a good place to start. Quote Link to comment https://forums.phpfreaks.com/topic/220270-how-do-i-use-group_concat-with-order-by/#findComment-1141473 Share on other sites More sharing options...
JipThePeople Posted November 30, 2010 Author Share Posted November 30, 2010 The documentation is a good place to start. Thx much. Quote Link to comment https://forums.phpfreaks.com/topic/220270-how-do-i-use-group_concat-with-order-by/#findComment-1141488 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.