Jump to content

Group Concat Fails


unemployment

Recommended Posts

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.