Jump to content

How Do I Use GROUP_CONCAT With ORDER BY?


JipThePeople

Recommended Posts

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'])

Link to comment
https://forums.phpfreaks.com/topic/220270-how-do-i-use-group_concat-with-order-by/
Share on other sites

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.