Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
There is a table name customer and it have field customerid, groupid and i want to find the unique customerid who is not present in the groupid=6.

one customer can present in the one group or so many group, like customerid=2 is present in (6,7,8,9) etc..

I write the query but it is not working.
SQL
select * from customer where groupid1 !=6;

please help me.....
Posted
Updated 1-Dec-11 15:03pm
v4
Comments
[no name] 1-Dec-11 21:04pm    
EDIT: added "code" tag

SQL
select distinct customerid from customer where groupid <> 6
 
Share this answer
 
Comments
matadeen 16-Nov-11 2:40am    
no friend it is not working it checked that. when we execute that query and again select any customer id, and give query

select * from customer where customerid= select from your query.

the result was it is present in the group id 6.
Prerak Patel 16-Nov-11 6:20am    
Couldn't get you mate...
select customerid from customer where customerid not in ( select coustomerid from customer where GroupID=6 )
 
Share this answer
 
v2

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