master table1名称:master_port
port_name(列名)
ABC
SDF
EFR
GTY
FGH
侨
NMU
LOI
KUJ
SEC
FFR
ETY
我需要来自table2和table3(都是orgin_port和destination_port)的端口列表,这些端口列表在主表1中找不到名称:master_port 我怎么得到那些使用mysql查询 请帮我解决这个问题
答案 0 :(得分:0)
SELECT tab.port FROM
(SELECT origin_port AS port FROM location1
UNION DISTINCT
SELECT destination_port AS port FROM location1
UNION DISTINCT
SELECT origin_port AS port FROM sender2
UNION DISTINCT
SELECT destination_port AS port FROM sender2) tab
WHERE tab.port NOT IN
(SELECT port_name FROM master_port);
这两个表location1和sender2中的返回源和目标端口在master_port
中找不到