Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Need help to build recursive query

$
0
0
Hi There,Sample Data : [code="sql"]create table #sample (Mainstream int, Substream1 int , substream2 int , [status] varchar(10))Insert into #sample values (1,2,4,'Valid')Insert into #sample values (2,6,3,'Valid')Insert into #sample values (3,2,1,'Valid')Insert into #sample values (4,1,null,'InValid')Insert into #sample values (5,6,null,'Valid')Insert into #sample values (6,null,null,'Valid')[/code]Above is the sample data.This is self referencing table. Mainstream column is based on the sub streams. If any of the sub stream fails then corresponding main stream also fail.I will be available with the status based on main stream. I have to find the current status based on the sub stream's status.[img]http://www.sqlservercentral.com/Forums/Attachment17780.aspx[/img] How can I handle this ????

Viewing all articles
Browse latest Browse all 3145

Trending Articles