数据库:PostgreSQL
假设我有
table A(integer a_id, timestamp x, timestamp y)
table B(int b_id, timestamp n, timestamp m)
m
可null
我想用这个结构获取数据
SELECT a_id, j.b_id, k.b_id
FROM A, B AS j, B AS k
WHERE (x BETWEEN j.n AND j.m) AND (y BETWEEN k.n AND k.m.)
何时(x BETWEEN j.n AND j.m) AND (y BETWEEN k.n AND k.m.)
找不到匹配项
null j.b_id
我仍然希望查询使用or获取数据null k.b_id
我怎么做?