query help
SELECT group_concat( s1.user_name, s2.user_name, s3.user_name
SEPARATOR '-' ) , group_concat( s1.user_id, s2.user_id, s3.user_id
SEPARATOR ',' )
FROM `partners_staffs` s1
LEFT JOIN `partners_staffs` s2 ON s1.primary_user = s2.user_id
LEFT JOIN `partners_staffs` s3 ON s2.primary_user = s3.user_id
How do I get this in undefined loops let me say if 4 loops I will have
name1-name2,name3,name4
if 3 loops
name1-name2,name3
if 2 loops
name1-name2
Is there any method I can use?
Thank you for reading.
Subject
Written By
Posted
query help
April 05, 2014 09:23AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.