Quantcast
Channel: Martin Dráb's Activities
Viewing all articles
Browse latest Browse all 17532

notexists join query

$
0
0

Hello,

I have two tables

RHRMUniformForAttestationMap      COPlanEmplTable

fields                                                   fields 

CodeId                                                CodeId, EmplId

relation is COPlanEmplTable.codeid = RHRMUniformForAttestationMap.codeid

I need to get such records from  RHRMUniformForAttestationMap which do not exist in COPlanEmplTable and coempltable.emplid = "1234"

I tried something like this

RHRMUniformForAttestationMap RHRMUniformForAttestationMap;
COPlanEmplTable COPlanEmplTableLoc2, COPlanEmplTableLoc3

while select COCodeId from RHRMUniformForAttestationMap
    join RecId from COPlanEmplTableLoc2
        where COPlanEmplTableLoc2.EmplId == "1234" &&
              COPlanEmplTableLoc2.COCodeId == RHRMUniformForAttestationMap.COCodeId
    notexists join RecId from COPlanEmplTableLoc3
        where COPlanEmplTableLoc3.COCodeId == RHRMUniformForAttestationMap.COCodeId

but this doesn't work. I believe it can be done by means of the subqueries but is it possible to do by means of only one query? Could you pls point me to the right direction?

Thank you.


Viewing all articles
Browse latest Browse all 17532

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>