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
 SQL Server 2012 Forums
 Transact-SQL (2012)
 help me in query

Author  Topic 

niyaz4872
Starting Member

41 Posts

Posted - 2014-10-21 : 05:34:32
following is my table structure
ID level sys_ID ref_ID
1286403304 2 2110 279
1286403118 3 2115 2110
1286412300 3 2116 2110
1286403023 4 2127 2115
1286411200 4 2128 2115
1286412101 4 2404 2116
1286409100 5 2405 2404
1286410101 5 2406 2404
1286411100 5 2129 2128

following is sample results i wan't
ID level sys_ID ref_ID
1286403304 2 2110 279
1286403118 3 2115 2110
1286403023 4 2127 2115
1286411200 4 2128 2115
1286411100 5 2129 2128
1286412300 3 2116 2110
1286412101 4 2404 2116
1286409100 5 2405 2404
1286410101 5 2406 2404

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-10-21 : 08:45:19
What have you tried so far?
Go to Top of Page

niyaz4872
Starting Member

41 Posts

Posted - 2014-10-21 : 14:22:53
Hi All I was doing this regularly. But I do not know how
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-10-21 : 14:41:35
Well, you really should try to write the query yourself before posting here.

Your sample data seems to be the same in input and output, except for the order. What do you actually want to achieve?
Go to Top of Page
   

- Advertisement -