tags:

views:

29

answers:

2

Hi friends,I have two tables.One table contain the values
+---------+
Users
---------+
A
B
C
D
E
F
+----------+
And in another table I am having
+--------+
Active
+--------+
C
D
G
H
I
`+--------+

From the two table I need to get the Users only those who are not in the Active.For this the expected result is
+------+
Result
+------+
A
B
E
F
+-------+

+3  A: 
Select * from users u 
where not exists (
     select 1 from active a where u.Field  = a.Field
 )
Michael Pakhantsov
A: 

try it like this (replace id with your fields name):

SELECT
  *
FROM
  users u
WHERE
  id NOT IN (SELECT id FROM active WHERE id = u.id)
oezi