結合された行に追加情報を追加するにはどうすればよいですか?
SELECT column1, column2
FROM table1
LEFT JOIN table2
ON column1 = col1_table2 //The row which matches with this join should have additional information e.g. "'joined' AS info
あなたの助けをどうもありがとう!
あなたの質問を理解すれば、これはうまくいくはずです:
SELECT
t1.column1,
t1.column2,
CASE WHEN t2.col1_table2 IS NOT NULL THEN 'joined' END AS info
FROM table1 t1
LEFT JOIN table2 t2 ON t1.column1 = t2.col1_table2
これを試して:
SELECT column1,
column2,
CASE WHEN col1_table2 IS NOT NULL THEN 'joined' END AS additional_field
FROM table1
LEFT JOIN table2 ON column1 = col1_table2