Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Inclusion & exclusions with in the same table Post Reply Post New Topic
Author Message
achandana01
Groupie
Groupie
Avatar

Joined: 20 Jul 2011
Online Status: Offline
Posts: 59
Quote achandana01 Replybullet Topic: Inclusion & exclusions with in the same table
    Posted: 07 Feb 2014 at 10:47am
Hello ,

I have data something like this, I only need to include all employees who has access to dept 50 and excludes employees who have access to department 100


Employee ID     Line     Department ID
100              1     350
100              2     150
100              3     250
100              4     50
100              5     450
101              1     50
101              2     100
101              3     150
101              4     250


my data looks something like this

100              1     350
100              2     150
100              3     250
100              4     50
100              5     450

101 employee has access to both 100 & 50 so he has to be eliminated.

Thanks !!!


Edited by achandana01 - 08 Feb 2014 at 8:16am
chand
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 10 Feb 2014 at 5:28am
create a command, something like:
select distinct employeeID
from table incd
LEFT join (select employeeID from table excl
             where excl.dept = 100) sub
    on incd.employeeID = sub.employeeID
where incd.dept = 50 and sub.employeeID is null

should work...
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.030 seconds.