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
 mutliple query on same table

Author  Topic 

schilgod
Starting Member

1 Post

Posted - 2010-05-19 : 15:20:36
Hi,
i have a table as below

new_id old_id
2001 2004
2004 2008
2008 2010

as you can see the i have to get old_id using new_id, and check if new_id has any value as the previous old_id and get its old_id....

How can i write a sql query for this?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-05-19 : 18:23:05
check out recursive cte


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

prakash.mestry
Starting Member

4 Posts

Posted - 2010-05-20 : 01:05:03
can u put expected output?

Thanks
prakash.mestry@hotmail.com
Go to Top of Page
   

- Advertisement -