Jump to content

end characters of GROUP_CONCAT being cut


unxposed

Recommended Posts

I have a query where I have a concat nested inside a group concat. The problem I'm having is that the last x amount characters are being cut from the result. for example below at the end of the position column instead of finishing 'Position unknown' it finsihes 'Position'?

 

GROUP_CONCAT(
  DISTINCT CONCAT(
    people.name, ' - ', IFNULL(members.position, 'Position unknown')
  ) SEPARATOR '~'
) AS position

 

Thanks

Link to comment
Share on other sites

Hi,

 

Thanks for the reply. I'm actually doing this directly in phpmyadmin so definately a sql issue. Here's the exact code:

 

SELECT parties.id, GROUP_CONCAT(DISTINCT CONCAT(people_lang.name, ' - ', IFNULL(members_lang.position, 'Position unknown')) SEPARATOR '~') AS position
FROM parties
LEFT JOIN members ON parties.id = members.party
LEFT JOIN members_lang ON members.id = members_lang.member AND members_lang.il8n = 1
LEFT JOIN people_lang ON members.person = people_lang.person AND people_lang.il8n = 1

 

And the result:

 

Hla Myint Oo - Position unknown~Htay Win - Position unknown~Maung Oo - Position unknown~Thura Shwe Mann - Position unknown~Thiha thura Tin Aung Myint Oo - Position unknown~Khoo Francis Ko - candidate~Soe Maw Ye - Position unknown~Shwe Nan - Position unknown~Saw Htay - Position unknown~Kyaw Aye - Position unknown~Moe Myint Thein - Position unknown~San Htun - Position unknown~Maung Maung Oo - Position unknown~Win Myint Dr USDP - Position unknown~Soe Aung - Position unknown~Htay Maung - Position unknown~Khin Maung Htay 2 - Position unknown~Mat Gyi USDP - Position unknown~Tin Kha - Position unknown~Nu USDP - Position unknown~Tin Yu - Position unknown~Shwe Aung USDP - Position unknown~Nyunt Tin - Position unknown~Maung Thin Dr - Position unknown~Zin Nyunt - Position unknown~Win Naung - Position unknown~Myo Thant Tin Dr - Position unknown~Mya Nyein - Position unknown~Myint Kyi Dr - Position unknown~Khin Shwe Dr - Position unknown~Aye Maut - Position unknown~Than Soe - Position unknown~Thein Aung USDP - Position unk

 

Thanks

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.