解决方案 »
- ALTER TABLE CODINGQUESTION DROP COLUMN username 报 ora-00904 标识符无效
- Hibernate-Many-to-one
- 大家帮我看一下是什么错误!!
- oracle8i数据库导入的问题?-----怪问题
- SQL*Plus 工作单的下半部分显示查询结果时,为什么总要自动换行?
- 怎么得到已有用户的表空间大小,在线等,解决马上给分
- 请问建表的问题!
- DBMS_OUTPUT.ENABLE作什么用?
- 想在存储过程中建表,可是系统总告诉我权限不足,我改怎么办呢?
- 查看JOBS的语句怎么么写啊
- 如何删除大量数据?
- 在更新表中记录后如何把没有被更新的记录删除
where exists(select 1 from a t1,b t2,c t3
where t1.id=t2.id and t2.idd=t3.idd and t3.签字状态='3' and t1.订单号=t.订单号)这样试试
但是这条
SO00001 null null 1004 …
还是没出来
from A Left join B on A.id = B.id left join C on B.idd = c.idd
where exists
(
select 1 from a t1,b t2,c t3
where t1.id=t2.id and t2.idd=t3.idd and t3.签字状态='3'
)这样试试呢
那这么写呢
select * from(
select A.订单号,B.出库单号,B.出库日期,C.签字状态 …,max(decode(c.签字状态,'3',1,0))over(partition by a.订单号)m from A Left join B on A.id = B.id left join C on B.idd = c.idd
)
where m=1
试试
from (select A.订单号,B.出库单号,B.出库日期,C.签字状态 …
from A Left join B on A.id = B.id left join C on B.idd = c.idd )
where nvl(签字状态,3) = 3;以为签字状态为3是B,C两表所加的影响,而为NULL是A表纪录的原因,如果在B,C表上加条件则无法取出A表数据,如果对A表做条件则无法取出=3的纪录,如果A,B,C表联合条件则无法取出完整结果。简易方式,在你本身的SQL外层包装一下。
from (select A.订单号,B.出库单号,B.出库日期,C.签字状态 …
from A Left join B on A.id = B.id left join C on B.idd = c.idd )
where nvl(签字状态,3) and 签字状态 is not null ;