Include null results in group_concat

前端 未结 2 1772
旧时难觅i
旧时难觅i 2021-01-23 04:26

I have two tables like this

profile_answers

+---------+------------+
|      id | class_name |
+---------+------------+
|       1 | Class         


        
2条回答
  •  天涯浪人
    2021-01-23 04:48

    SELECT id,IFNULL(samples,'NULL') sample FROM 
    (
        SELECT
            AA.id,
            GROUP_CONCAT(DISTINCT BB.sample) samples
        FROM
            profile_answers AA LEFT JOIN educations BB
            ON AA.id = BB.profile_answers_id
        GROUP BY AA.id
    ) A;
    

提交回复
热议问题