Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 about sql queries

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-01 : 14:52:02
nandeesh writes "I have 2 tables:
Schedule: Employee_id, Logintime and Logoutime (no Uniques)
Logtime: EmployeeID,LoginTime and LogoutTime (no Uniques)

In both the table i have same set of datas

One Employee can Login Twice a day.
for exmp: e001 with login ID 5:30:00 and 12:30:00
I will delete one employee ID having login time 5:30:00 but in logtime table both records are present,
I want to write a query in that i want to retrive the Employee_IDs from logtime in which were delete in Schedule table for ex: i have deleted e001 of login time 5:30:00 i have to retrive this employee id in a query"

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-08-02 : 02:25:47
Hi nandeesh

So are you saying that you want to retrieve all the distinct LogTime.employeeID for which there is no match in Schedule?
select distinct l.employeeID 
from Logtime l left join schedule s
on l.employeeID = s.employee_id
where e.employee_id is null

?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -