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
 Other Forums
 MS Access
 can we use Like and Not exists in same query

Author  Topic 

itchocks
Starting Member

44 Posts

Posted - 2004-11-23 : 01:51:32

Hai ,

can any one tell me how to make it work both the like and not exists in the same query, the below query is not returning the datas (i.e) no records. but in database the records are there

select * from EmpDetail where EmpDetail.Badge_No Like '%1%' and not exists (select * from AvailEmp where EmpBn = EmpDetail.Badge_No) order by EmpDetail.Badge_No

above is my query , if i use it withou Like statement the query is working.

The EmpDetails is the Employee's Detail table which contain all the employees Badge_No & Name etc, some employees where already assigned to a task for example (Operator To SupervisingOperator) then he will be stored in the AvailEmp table,

so i need to filter the employees who were already assigned to a job (who are in the AvailEmp table), now i will get the Employee who are free and need to be assign the work.

Now the user have decided to issue one employee means then he will type 3 means then all the employee Badge_No containing 3 should be shown in the list at the same time the Employee should not be available in the AvailEmp table.

I hope i have given u the informations. when i use the query without the Like statement i am getting the records withouth the employee in the AvailEmp table and the value return for this query is correct.

kindly reply me how to rectify.

Thank you very much,
Chock.:)

Chock
   

- Advertisement -