I have 10 employee details in one table with employeeid
Every day i have to allocate some work to those 10 employee.
If i forgot to allocate work for 2 employee out of 10.
How i find allocated employee and unallocated employee....
I need the query....
Loading

sr har5 reputationPosted Jun 18, 2012, 11:21 PM EDT
sr har5 reputationPosted Jun 18, 2012, 11:22 PM EDT
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Jun 18, 2012, 11:35 PM EDT
Table -Employee
ID, -EMployee Id
Name-Employee names
Table- Allocation
ID -Foreign key ref
Date- For each date
Status- Allocated(Y) or Not(N).
to find empl allocated:
Select * from Employee where id in (select id from Allocation where date ='' and status='Y'))
to find those who are not allocated
Select * from Employee where id in (select id from Allocation where date ='' and status='N'))
Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 18, 2012, 11:58 PM EDT
First we required table structure which is used by you.
after that we able to write query for you.
Or You required any input for design table?
thx.
Kunal VaishyaRank #990 · 2K reputationPosted Jun 19, 2012, 12:19 AM EDT
Select EmpId , EmpName From EmployeeMaster Where EmpId Not In (SELECT EmpId From AllocationTable Where DateTime ='GetDate' )
You can get UnAllocatted Employee Using This Query For PArtucaular Day You can also pass data instead of "Getdate"