unemployment Posted May 3, 2011 Share Posted May 3, 2011 My group concat does not work at all. It is not concatinating the action_id and action descriptions into a delimited list. SELECT users.id, users.firstname, users.lastname, users.username, companies.industry AS industry, companies.stage AS stage, companies.companytag AS companytag, '' AS gender, '' AS accounttype, companies.country, companies.state, companies.city, UNIX_TIMESTAMP(`company_actions`.`time`) AS `approved_date`, '' AS FeedId, companies.companyname AS FeedFirstName, '' AS FeedLastName, '' AS FeedUserName, GROUP_CONCAT(actions.actionsdescription SEPARATOR '~#') AS `action_ids`, GROUP_CONCAT(company_actions.details SEPARATOR '~#') AS `action_details` FROM users INNER JOIN employees ON employees.userid = users.id INNER JOIN companies ON employees.companyid = companies.companyid INNER JOIN company_actions ON company_actions.company_id = companies.companyid INNER JOIN actions ON company_actions.action_id = actions.id WHERE users.id = ${uid} AND `company_actions`.`time` < ${time} GROUP BY users.firstname, users.lastname, users.username, industry, stage, companytag, gender, accounttype, companies.country, companies.state, companies.city, `approved_date`, FeedId, FeedFirstName, FeedLastName Quote Link to comment https://forums.phpfreaks.com/topic/235443-group-concat-fails/ Share on other sites More sharing options...
fugix Posted May 3, 2011 Share Posted May 3, 2011 what errors do you receive when you use mysql_error().? Quote Link to comment https://forums.phpfreaks.com/topic/235443-group-concat-fails/#findComment-1210122 Share on other sites More sharing options...
unemployment Posted May 3, 2011 Author Share Posted May 3, 2011 what errors do you receive when you use mysql_error().? I don't receive any errors, but it still doesn't concatenate my rows. I assume that it would do this for example uid aid 1 2 1 3 1 4 and turn it into something like... uid aid 1 2, 3, 4 Is that what is supposed to happen? Quote Link to comment https://forums.phpfreaks.com/topic/235443-group-concat-fails/#findComment-1210133 Share on other sites More sharing options...
fugix Posted May 3, 2011 Share Posted May 3, 2011 yes that is what should happen, and it will seperate the values with what you have you SEPERATOR set to Quote Link to comment https://forums.phpfreaks.com/topic/235443-group-concat-fails/#findComment-1210157 Share on other sites More sharing options...
fugix Posted May 3, 2011 Share Posted May 3, 2011 can i see the code with query in it? Quote Link to comment https://forums.phpfreaks.com/topic/235443-group-concat-fails/#findComment-1210158 Share on other sites More sharing options...
unemployment Posted May 4, 2011 Author Share Posted May 4, 2011 I found the problem. My approved_date is off by 1 second in each row making it not concatenate. Is there anyway I could say... concatenate all of the approved_date that show up over a 10 second period? Quote Link to comment https://forums.phpfreaks.com/topic/235443-group-concat-fails/#findComment-1210204 Share on other sites More sharing options...
fenway Posted May 11, 2011 Share Posted May 11, 2011 You mean by rounding? Quote Link to comment https://forums.phpfreaks.com/topic/235443-group-concat-fails/#findComment-1213800 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.