0

My current code snippet is given below. I want to use "NOT IN" query instead of left join.

    from Complaints C
    inner join Employees E on E.ID = C.EmployeeID 
    left join ComplaintInfractionMapping CIM on CIM.ComplaintID = C.ID 

How to use "NOT IN" Query in stored procedure . In below code there is syntax error.

    from Complaints C
    inner join Employees E on E.ID = C.EmployeeID 
    NOT IN SELECT InfractionComment,InfractionDate FROM ComplaintInfractionMapping where ComplaintID =  C.ID
mridul
  • 1,986
  • 9
  • 29
  • 50

1 Answers1

1

you can do like this way :-

from    Complaints C
        inner join Employees E on E.ID = C.EmployeeID 
Where   Not Exists (    SELECT   InfractionComment
                                ,InfractionDate 
                        FROM    ComplaintInfractionMapping 
                        where   ComplaintID =  C.ID
                    )
Mihir Shah
  • 948
  • 10
  • 17