2017-05-19 74 views
0

我有一些問題,我的數據庫查詢:如何使用兩行將兩列顯示爲一列?

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| 
|       | 
============================ 
+0

左對齊SQL太難看...... – jarlh

+0

只是改變'|| ' - ' ||'爲'|| CHR(10)||' –

+0

我使用PostgreSQL @Shadow –

回答

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