Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我需要知道如何从查询(将 2 个表与外部联接连接起来)中获取结果,即使指向空表的 where 子句没有结果。
例子:
结果当前看起来如何SQLFiddle。 结果应该如何看起来像SQLFiddle。
在此示例中使用外连接时,不要使用 WHERE 子句,因为它将其视为内连接。
所以只说 AND 而不是 where
SELECT * FROM FilledTable LEFT OUTER JOIN EmptyTable ON FilledTable.Id = EmptyTable.RefFilledTableId and EmptyTable.Value = 5
http://sqlfiddle.com/#!2/7a96a/9