我有两个名为document
和levelnew
表1:文件:
document(mno,dept,step1_userid,step2_userid,step3_userid)
select * from document where step3_userid is not null;
表2:levelnew:
levelnew(dept,level2_id,level3_id)
select dept from levelnew where level3_id='40016022';
我可以加入表格并获得单一结果的答案吗?
答案 0 :(得分:0)
在部门加入
select A.*,B.dept from document A inner join levelnew B On
A.dept = B.dept
Where step3_userid is not null and level3_id='40016022'
答案 1 :(得分:0)
以下查询将提供所需的结果: -
select
D.*,L.dept
from
document D
inner join
levelnew L on D.dept=L.dept
where L.level3_id='40016022' AND D.step3_userid is not null;