Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL select where

Status
Not open for further replies.

RosieGp

Programmer
Jun 23, 2009
83
US
I have the following query:

Select [ID],[EmployeeNum],[EmployeeName],[DateStarted], [DateCompleted]
From [EmployeeLog] EL
where exists (select 1
from [EmployeeAddress] EA
where EA.JobStatus = 'Y'
and EA.ID = EL.ID
and EA.EmployeeNum = EL.EmployeeNum)

I want to add 1 more conditions to this...
and [DateCompleted] = NULL; [DateCompleted] (datetime) only exists in [EmployeeLog] Table...

I tried the following:

Select [ID],[EmployeeNum],[EmployeeName],[DateStarted], [DateCompleted]
From [EmployeeLog] EL
where exists (select 1
from [EmployeeAddress] EA
where EA.JobStatus = 'Y'
and EA.ID = EL.ID
and EA.EmployeeNum = EL.EmployeeNum
and EL.DateCompleted = NULL)

It did not work...
Please reply... Any help is appreciated

 
sorry, I saw what i had wrong...
so sorry guys...

Select [ID],[EmployeeNum],[EmployeeName],[DateStarted], [DateCompleted]
From [EmployeeLog] EL
where exists (select 1
from [EmployeeAddress] EA
where EA.JobStatus = 'Y'
and EA.ID = EL.ID
and EA.EmployeeNum = EL.EmployeeNum
and EL.DateCompleted IS NULL)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top