Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Help Writing Query

$
0
0

I have two tables one that contains employees who are not eligible for rehire and one that contains employee information.  I want to query a count of employees where the employeename is not in the non-rehire table.  Essentially, run the syntax below.

Select firstName, lastName, phone, 
(count(case(when empId NOT IN (tbl_norehire) then empId)) As [Eligible For Rehire Count],
(count(case(when empID  IN (tbl_norehire) then empID)) As [No Rehirable Count]
From tbl_employeeInformation Inner Join tbl_norehire ON tbl_employeeInformation.empID = tbl_norehire.empID


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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