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
 General SQL Server Forums
 New to SQL Server Programming
 Regarding fetching records

Author  Topic 

U A
Starting Member

11 Posts

Posted - 2010-11-08 : 05:44:03
i have two columns c1 and c2
eg:
c1 c2
10 12
12 14
14 null

i can get record 12 in column c2 and with this 12 in c2 that compare 12 is there in c1 so the corresponding c2 for that 12 is 14 , then corresponding 14 for c1 is null .

this is the scenario i want result as 14 because corresponding c2 is null so i want that 14 as result

please help me to get this query

Thank You

U A

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-08 : 05:49:52
This?

select c1 from table t1 where not exists(select * from table t2 where t1.c1 = t2.c2)


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

U A
Starting Member

11 Posts

Posted - 2010-11-08 : 06:53:28
Thank You webfred

U A
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-08 : 07:08:59
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -