我试图从"tbl_gig"
表中获取记录,同时比较其中的不同行。
我试过这个但没有运气:
SELECT * FROM tbl_gig as t2 INNER JOIN tbl_gig as t3
WHERE t2.gig_city=t3.gig_city
AND t2.artist_id=t3.artist_id
AND t2.partner_id < t3.partner_id
GROUP BY t2.gig_eventDate;
预期输出:
gig_id gig_artist_id gig_partner_id
1 1 1
2/3 1 1/2
4 1 1
请帮忙。
答案 0 :(得分:0)
SELECT
GROUP_CONCAT(gig_id SEPARATOR '/') as gig_id,
artist_id ,
GROUP_CONCAT(partner_id SEPARATOR '/') as partner_id
FROM tbl_gig
GROUP BY artist_id