如何用两行将两列显示在一列中?

时间:2017-05-19 09:01:22

标签: sql postgresql

我的数据库查询有问题:

SELECT 
    a.survey_id,
    c.questions_first_language ||'-'|| c.questions_second_language as statements,
FROM survey a
    LEFT JOIN survey_questions b
        on a.survey_id = b.survey_id

列"语句如何"看起来像这样:

 ============================
 statements
 ============================
 | questions_first_language |
 | questions_second_language|
 |__________________________|
 | questions_third_language |
 | questions_fourth_language|
 |                          |
 ============================

1 个答案:

答案 0 :(得分:1)

只是两行?此?

SELECT 
a.survey_id,
c.questions_first_language ||chr(10)|| c.questions_second_language as statements,
FROM survey a
LEFT JOIN survey_questions b
on a.survey_id = b.survey_id