请在下面查询。
select * from table tab1,
table tab2,
table tab3
where tab1.sid = tab2.sid
and tab2.referencedid = tab3.referencedid
我的要求是 tab3的列值 tab3.referencedid 然后使用和条件并填充记录。请建议我如何实现这一目标。基于NOT NULL条件,应获取查询结果
答案 0 :(得分:0)
MySQL中IS NOT NULL条件的语法是:
field IS NOT NULL
答案 1 :(得分:0)
据我所知,在这种情况下,最好使用JOIN在Where子句中使用join
SELECT *
FROM table1 t1
JOIN table2 t2 ON t1.sid = t2.sid
JOIN table3 t3 ON t2.referencedid = t3.referencedid
WHERE // here you can add your criteria if you have