insert into Temp_ParallelMethods values(1,2)insert into Temp_ParallelMethods values(1,3)insert into Temp_ParallelMethods values(1,4)insert into Temp_ParallelMethods values(1,5)

insert into Temp_ParallelMethods values(2,1)insert into Temp_ParallelMethods values(2,3)insert into Temp_ParallelMethods values(2,4)insert into Temp_ParallelMethods values(2,5)

insert into Temp_ParallelMethods values(3,2)insert into Temp_ParallelMethods values(3,1)insert into Temp_ParallelMethods values(3,4)insert into Temp_ParallelMethods values(3,5)

insert into Temp_ParallelMethods values(4,2)insert into Temp_ParallelMethods values(4,3)insert into Temp_ParallelMethods values(4,1)insert into Temp_ParallelMethods values(4,5)insert into Temp_ParallelMethods values(5,2)insert into Temp_ParallelMethods values(5,3)insert into Temp_ParallelMethods values(5,4)insert into Temp_ParallelMethods values(5,1)

Table B gives which tasks can be performed together or parallel.Table B

TestTask Parallel Tests T104 T105T104 T106T104 T107T104 T108T104 T109

E.g. Test T103 has timing of 90 days Test T104 has timing of 40 days Test T105 has timing of 50 days. Test T106 has timing of 50 days. Test T107 has timing of 45 days. Test T108 has timing of 46 days. Test T109 has timing of 49 days. T104 can be run parallel with T105 & 106 &107 &108 &109how i should write sql query to get Total days for all Records like below Total Timing = Timefor T103 + Max( all parallel tests) Total Timing = 90 +max(40,50,50,45,46,49) = 140 daysThanks

I don't see where it says that T105 can be run in parallel with T106, even though both can be run in parallel with T104. Can we assume that being able to run in parallel is a transitive property?

Table B gives which tasks can be performed together or parallel.Table B

TestTask Parallel Tests T104 T105T104 T106T104 T107T104 T108T104 T109

E.g. Test T103 has timing of 90 days Test T104 has timing of 40 days Test T105 has timing of 50 days. Test T106 has timing of 50 days. Test T107 has timing of 45 days. Test T108 has timing of 46 days. Test T109 has timing of 49 days. T104 can be run parallel with T105 & 106 &107 &108 &109how i should write sql query to get Total days for all Records like below Total Timing = Timefor T103 + Max( all parallel tests) Total Timing = 90 +max(40,50,50,45,46,49) = 140 daysThanks

I don't see where it says that T105 can be run in parallel with T106, even though both can be run in parallel with T104. Can we assume that being able to run in parallel is a transitive property?

i tried below query, but this does not work with all scenarios. it always get Max values for test which does not have parallel test , rather it should SUM for different tests.

SELECT SUM(vbn.new) as NewestimatedTime from

(SELECT CASE WHEN xyz.parallelMethodId = 0 THEN sum(xyz.estimatedTIme) when xyz.parallelMethodId =1 THEN Max(xyz.estimatedTIme) end as newfrom(SELECT CASE WHEN abc.parallelMethodId IS NULL THEN 0 WHEN abc.parallelMethodId IS NOT NULL THEN 1 END as parallelMethodId,abc.estimatedTIme from(SELECT testmethod, Max(estimatedtime) as estimatedTIme , b.parallelMethodId FROM temp_testmethods A LEFT OUTER JOIN temp_parallelmethods B ON B.parallelmethodid = A.id WHERE testmethod IN ( 'T103', 'T102', 'T109','TX','TX1' ) group by testmethod,b.parallelMethodId) abc) xyz group by xyz.parallelMethodId) vbn

I looked at this, and it looks like your data is too clean to be representative, because your sets are disjoint and your subsets are complete. That is, if you define a set A as every test that can be run in parallel with test a, then every test within that set can be run in parallel with any other test in that set and cannot be run in parallel with any test that is not within that set.

In the real world, I would expect things to be much messier. For example, say tests A and B use the same set of equipment, so they cannot be run in parallel, but test C uses a different set of equipment, so it can be run in parallel with either or both A and B.

In this case,

Set A = {A, C}Set B = {B, C}Set C = {A, B, C}

Sets A and B are not disjoint, because they are not the same, but they both include {C}. SetC is not complete, because it includes tests A and B which cannot be run in parallel with each other.

I came up with a solution that works only if the sets are disjoint and the subsets are complete. I haven't posted it, because I don't think that it will work for your date, because I don't think your data will match that criteria.