By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

get non matching rows from table 2

P: 2
Hello,
I've been having trouble in getting proper results querying the following I have 2 tables T1 & T2, each of which has a single column C1. the data in each of the tables are as follows:
T1.c1
1
4
8
9
0
a
c
d
T2.c1
1
2
3
8
9

I would like the non matching rows only from T2, i.e I expect the results 2, 3 from T2. Any help to query the tables will be greatly appreciated.
Jan 25 '08 #1
Share this Question
Share on Google+
2 Replies


ck9663
Expert 2.5K+
P: 2,878
Hello,
I've been having trouble in getting proper results querying the following I have 2 tables T1 & T2, each of which has a single column C1. the data in each of the tables are as follows:
T1.c1
1
4
8
9
0
a
c
d
T2.c1
1
2
3
8
9

I would like the non matching rows only from T2, i.e I expect the results 2, 3 from T2. Any help to query the tables will be greatly appreciated.
try:
select * from t2 where c1 not in (select c1 from t1)

-- ck
Jan 25 '08 #2

P: 2
Thanks very much for your reply. I also tried using this and it worked , but yours seems simpler.
select t2.c1 from t2 except select t2.c1 from t2 inner join t1 on t1.c1=t2.c1
Jan 28 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.