アプリ版:「スタンプのみでお礼する」機能のリリースについて

添付の図の様に
id1とid2がそれぞれ一致した場合に結合させる動作をさせたいです。

どのようにSQLを発行させれば良いでしょうか。

「2つのテーブルを結合するときに,2つのI」の質問画像

A 回答 (2件)

SELECT


hoge1,hoge2,t1.id1,t1.id2,hoge3,hoge4,hoge5,hoge6
FROM sample_table1 AS t1
INNER JOIN sample_table2 AS t2
ON t1.id1=t2.id1 AND t1.id2=t2.id2
    • good
    • 0

select


t1.hoge1, t1.hoge2, t1.id1, t1.id2, t1.hoge3, t1.hoge4,
t2.hoge5, t2.hoge6
from sample_table1 t1, sample_table2 t2
where (t1.id1 = t2.id1) and (t1.id2 = t2.id2)
;

この文の場合、id1とid2が一致しない列は表示されません。
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!