Home Forums SQL Server 2012 SQL Server 2012 - T-SQL Sql Max query RE: Sql Max query
February 3, 2018 at 5:31 pm
drew.allen - Thursday, February 1, 2018 3:13 PMDD-533246 - Thursday, February 1, 2018 12:52 PMSQL server 2012 :
Need help with building query for max.
Table A has a record Ex: T103 and how much time it takes to complete a task.Table A
TestTask Estimated Days
T 103 90
T 104 40
T 105 50
T 106 50
T 107 45
T 108 45
T 109 49Table B gives which tasks can be performed together or parallel.
Table BTestTask Parallel Tests
T104 T105
T104 T106
T104 T107
T104 T108
T104 T109E.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 &109
how 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 days
ThanksI 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?
Drew
i have added insert script