所以我有3张桌子,
Companies (company_id, company_name)
Stock_Exchanges(stock_exchange_id, stock_exchange_name, stock_exchange_manager)
Stock_Exchanges_Companies(stock_exchange_id, company_id)
我正在尝试选择所有不在某个stock_exchange
.
到目前为止我有这个:
SELECT COMPANY_NAME
FROM COMPANIES c
LEFT OUTER JOIN STOCK_EXCHANGES_COMPANIES sec
ON c.COMPANY_ID = sec.COMPANY_ID
LEFT OUTER JOIN STOCK_EXCHANGES se
ON sec.STOCK_EXCHANGE_ID = se.STOCK_EXCHANGE_ID
WHERE sec.COMPANY_ID != se.COMPANY_ID;
但是,当我使用该WHERE
子句时,它返回零行。任何帮助,将不胜感激!