X-Received: by 10.182.39.138 with SMTP id p10mr7554782obk.5.1438772792552; Wed, 05 Aug 2015 04:06:32 -0700 (PDT) X-Received: by 10.182.209.6 with SMTP id mi6mr43412obc.27.1438772792499; Wed, 05 Aug 2015 04:06:32 -0700 (PDT) Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!pg9no7233483igb.0!news-out.google.com!nt1ni154igb.0!nntp.google.com!f3no7809053igg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: microsoft.public.sqlserver.programming Date: Wed, 5 Aug 2015 04:06:32 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=115.248.211.41; posting-account=UdCuKwoAAAB0-uLpIoFcSSp1N3kkQ94p NNTP-Posting-Host: 115.248.211.41 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <96f2781c-306a-4c7e-99a5-6cdc416a3bc0@googlegroups.com> Subject: Re: Need to fetch data recursively from a table From: siddhant agarwal Injection-Date: Wed, 05 Aug 2015 11:06:32 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com microsoft.public.sqlserver.programming:31266 On Wednesday, 5 August 2015 16:33:24 UTC+5:30, Erland Sommarskog wrote: > (siddhant171990@gmail.com) writes: > > - First, Find projects related to original set of features. Each > > feature can relate to only instance of a project. But, it can relate to > > many projects. > > So this is illegal? > > INSERT tbl(feature, project, instance) > VALUES ('FTR1', 'A', 1), > ('FTR1', 'A', 2) > > But this is legal? > > INSERT tbl(feature, project, instance) > VALUES ('FTR1', 'A', 1), > ('FTR1', 'B', 1) > > > That is, the instance relates to the project alone? > > > - Secondly, since some other instance of the projects found above may be > > related to some features, I need to identify those features as well and > > any other projects which these features are also related too. This will > > go on recursively. > > > > - Thirdly, every time we fetch features for the projects, we fetch only > > those features that use the instance of the projects greater than the on > > found already. > > > > - All in all, there should be some path starting for the initial feature > > list to all records. > > Please supply a wider set of test data with the expected results. This > helps to clarify your description. > > > > -- > Erland Sommarskog, Stockholm, esquel@sommarskog.se Yes, you cannot have 2 instances of the same project related to same feature.