mysql 表a不存在表b_[mysql]SQL查询存在A表但不存在B表的数据
select * from ti_road_node_code a where a.road_node_id not in (
select en_road_node_id from ti_road_node_relation b)
15毫秒
select * from ti_road_node_code a left join ti_road_node_relation b where a.road_node_id =en_road_node_id
and isnull(b.ex_road_node_id)
- 報錯
select a.* from ti_road_node_code a left join ti_road_node_relation b on a.road_node_id =b.en_road_node_id where
isnull(b.ex_road_node_id)
282毫秒
select a.* from ti_road_node_code a left join ti_road_node_relation b on a.road_node_id =b.en_road_node_id where
isnull(b.en_road_node_id)
一樣
SELECT a.* FROM ti_road_node_code a
WHERE NOT EXISTS (SELECT 1 FROM ti_road_node_relation b WHERE b.en_road_node_id = a.road_node_id)
540毫秒
總結
以上是生活随笔為你收集整理的mysql 表a不存在表b_[mysql]SQL查询存在A表但不存在B表的数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小忍者250能骑多重?
- 下一篇: python入门必备10个坑_适合 Py