- 我需要一个左连接查询视图
- 我有两个过滤器对这一观点与 参数为左,右表。
- 我需要从右表中的空行。
这第一个查询没有工作,但我可以从视图将其过滤:左连接查询的视图
select * from histoStatut h
left join listStatut ls on h.idstatutid = ls.idstatutid or ls.idstatutid is null
where h.idRequestid = 32651 and ls.IdListeId = 9 ;
本次查询的作品,但在分辩表中的过滤器是不是一个可以接受的观点:
select *
from (select * from HistoStatut)T1
left join
(select h.*,ls.IdListeId from HistoStatut h
inner join ListStatut ls on h.IdStatutId = ls.IdStatutId and ls.IdListeId = 9
) T2 on T1.IdHistoStatut = T2.IdHistoStatut
where T1.IdRequestId = 32651
我需要一个搜索解决方案n其中,我可以使用两个滤波器的一个观点:
CREATE VIEW AS My_Left_Join as
select *
from histoStatut h
left join listStatut ls
on h.idstatutid = ls.idstatutid;
Select * from My_Left_Join where IdListeId = 9 and IdRequestId = 32651
是否有景观的解决方案吗?
您可以跳过被null'条件,这里不需要了'ls.idstatutid。 – jarlh
“桌子上的过滤器对于view_而言是不可接受的”是什么意思? – jarlh
@Remay,请显示预期的查询结果。 – matrix