sar*_*sha 0 sql relational-division
我需要一个SQL语句来从数据库中提取具有附件标记的那些申请人.如果我想要7或8作为附件标签的aaplicant但是我需要具有这两个标签的申请人,则belowq语句可以正常工作.
select distinct(a.id) from applicant a
join applicantdeployment ad on a.id = ad.applicantid
join ApplicantAttachment at on a.id = at.applicantid
where a.applicanttype = 'TCN/LN' and ad.groundlocation in (4,8,14) and ad.deploymentstatus =1
and ad.trainingdeploymentstatus = 6 and at.tag in (7,8)
Run Code Online (Sandbox Code Playgroud)
例如,从下面的集合我只想要显示ids 7332,7451和7449.
ID Tag
7328 8
7328 8
7332 8
7332 7
7337 7
7449 8
7449 7
7451 8
7453 7
7451 7
谢谢!
| 归档时间: |
|
| 查看次数: |
3162 次 |
| 最近记录: |