SQL Left Join (Between Condition)
Is it possible to use a BETWEEN statement as开发者_运维百科 a condition for a LEFT JOIN?
SELECT Table_1.*, Table_2.*
FROM Table_1 LEFT JOIN Table_2
ON Table_1.value BETWEEN Table_2.Value_1 AND Table_2.Value_2
Yes, it is, but you need to specify a column name from Table_1
, like so:
SELECT Table_1.*, Table_2.*
FROM Table_1 LEFT JOIN Table_2
ON Table_1.Value BETWEEN Table_2.Value_1 AND Table_2.Value_2
精彩评论