Click here to Skip to main content
15,896,359 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how can i write in instead of not in ,in the below query
i want records in location_temp which is not in location table?
SQL
select *
from tblLocation_Temp
where tblLocation_Temp.Code
not in (
select tblLocation.Code
from tblLocation )
Posted
Updated 24-Jul-11 0:57am
v2
Comments
OriginalGriff 24-Jul-11 6:35am    
I'm sure English is not your native language, but it is the default language for this site.
In English, your question makes no sense at all.
Please, either try to find a better translation of your question to English, or find a site in your own native language, as they may be able to help you better than we can!
[no name] 24-Jul-11 6:44am    
He/she probably wants to rewrite this query using the 'IN' clause instead of the 'NOT IN' clause.
faezeh66 24-Jul-11 6:51am    
exactly
[no name] 24-Jul-11 6:43am    
What are you trying to achieve?
faezeh66 24-Jul-11 6:54am    
i want records in locationtemp which is not in location table?

SQL
select *
from tblLocation_Temp
where tblLocation_Temp.Code
not in (
select tblLocation.Code
from tblLocation )


this query is perfact if " tblLocation.Code " and " tblLocation_Temp.Code " are same type column.

if tblLocation_Temp.Code is numaric or " tblLocation.Code " is varchar then your query have a casting problem . ' solve this by cast as varchar '


i hope this help
 
Share this answer
 
Comments
raj_raje 28-Jul-11 21:53pm    
this correct for new users my 5 for you
 
Share this answer
 
it is correct.............................thanks shameel
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900