Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- L15.[Name] AS L15Talent
- ,L30.[Name] AS L30Talent
- ,L60.[Name] AS L60Talent
- ,L90.[Name] AS L90Talent
- ,L100.[Name] AS L100Talent
- ,t1.[Name] AS Trait1
- ,t2.[Name] AS Trait2
- ,t3.[Name] AS Trait3
- --Calculate the combination DPS by taking the base DPS
- ,rb.[DPS]
- --Add the gains for each individual talent or trait
- + (r15.[DPS] - rb.[DPS])
- + (r30.[DPS] - rb.[DPS])
- + (r60.[DPS] - rb.[DPS])
- + (r90.[DPS] - rb.[DPS])
- + (r100.[DPS] - rb.[DPS])
- + (rt1.[DPS] - rb.[DPS])
- + (rt2.[DPS] - rb.[DPS])
- + (rt3.[DPS] - rb.[DPS])
- --Add the pain gain/loss after removing the base DPS & individual talent/trait gains
- + (s1530.[DPS] - rb.[DPS] - (r15.[DPS] - rb.[DPS]) - (r30.[DPS] - rb.[DPS]))
- + (s1560.[DPS] - rb.[DPS] - (r15.[DPS] - rb.[DPS]) - (r60.[DPS] - rb.[DPS]))
- + (s1590.[DPS] - rb.[DPS] - (r15.[DPS] - rb.[DPS]) - (r90.[DPS] - rb.[DPS]))
- + (s15100.[DPS] - rb.[DPS] - (r15.[DPS] - rb.[DPS]) - (r100.[DPS] - rb.[DPS]))
- + (s15t1.[DPS] - rb.[DPS] - (r15.[DPS] - rb.[DPS]) - (rt1.[DPS] - rb.[DPS]))
- + (s15t2.[DPS] - rb.[DPS] - (r15.[DPS] - rb.[DPS]) - (rt2.[DPS] - rb.[DPS]))
- + (s15t3.[DPS] - rb.[DPS] - (r15.[DPS] - rb.[DPS]) - (rt3.[DPS] - rb.[DPS]))
- + (s3060.[DPS] - rb.[DPS] - (r30.[DPS] - rb.[DPS]) - (r60.[DPS] - rb.[DPS]))
- + (s3090.[DPS] - rb.[DPS] - (r30.[DPS] - rb.[DPS]) - (r90.[DPS] - rb.[DPS]))
- + (s30100.[DPS] - rb.[DPS] - (r30.[DPS] - rb.[DPS]) - (r100.[DPS] - rb.[DPS]))
- + (s30t1.[DPS] - rb.[DPS] - (r30.[DPS] - rb.[DPS]) - (rt1.[DPS] - rb.[DPS]))
- + (s30t2.[DPS] - rb.[DPS] - (r30.[DPS] - rb.[DPS]) - (rt2.[DPS] - rb.[DPS]))
- + (s30t3.[DPS] - rb.[DPS] - (r30.[DPS] - rb.[DPS]) - (rt3.[DPS] - rb.[DPS]))
- + (s6090.[DPS] - rb.[DPS] - (r60.[DPS] - rb.[DPS]) - (r90.[DPS] - rb.[DPS]))
- + (s60100.[DPS] - rb.[DPS] - (r60.[DPS] - rb.[DPS]) - (r100.[DPS] - rb.[DPS]))
- + (s60t1.[DPS] - rb.[DPS] - (r60.[DPS] - rb.[DPS]) - (rt1.[DPS] - rb.[DPS]))
- + (s60t2.[DPS] - rb.[DPS] - (r60.[DPS] - rb.[DPS]) - (rt2.[DPS] - rb.[DPS]))
- + (s60t3.[DPS] - rb.[DPS] - (r60.[DPS] - rb.[DPS]) - (rt3.[DPS] - rb.[DPS]))
- + (s90100.[DPS] - rb.[DPS] - (r90.[DPS] - rb.[DPS]) - (r100.[DPS] - rb.[DPS]))
- + (s90t1.[DPS] - rb.[DPS] - (r90.[DPS] - rb.[DPS]) - (rt1.[DPS] - rb.[DPS]))
- + (s90t2.[DPS] - rb.[DPS] - (r90.[DPS] - rb.[DPS]) - (rt2.[DPS] - rb.[DPS]))
- + (s90t3.[DPS] - rb.[DPS] - (r90.[DPS] - rb.[DPS]) - (rt3.[DPS] - rb.[DPS]))
- + (s100t1.[DPS] - rb.[DPS] - (r100.[DPS] - rb.[DPS]) - (rt1.[DPS] - rb.[DPS]))
- + (s100t2.[DPS] - rb.[DPS] - (r100.[DPS] - rb.[DPS]) - (rt2.[DPS] - rb.[DPS]))
- + (s100t3.[DPS] - rb.[DPS] - (r100.[DPS] - rb.[DPS]) - (rt3.[DPS] - rb.[DPS]))
- + (st1t2.[DPS] - rb.[DPS] - (rt1.[DPS] - rb.[DPS]) - (rt2.[DPS] - rb.[DPS]))
- + (st1t3.[DPS] - rb.[DPS] - (rt1.[DPS] - rb.[DPS]) - (rt3.[DPS] - rb.[DPS]))
- + (st2t3.[DPS] - rb.[DPS] - (rt2.[DPS] - rb.[DPS]) - (rt3.[DPS] - rb.[DPS]))
- AS DPS
- FROM (SELECT * FROM Talent WHERE ClassID = 1 AND SpecID = 1 AND Row = 15) AS a --Return all L15 talents
- --Cross joins generate all possible combinations of talents
- CROSS JOIN (SELECT * FROM Talent WHERE ClassID = 1 AND SpecID = 1 AND Row = 30) AS b
- CROSS JOIN (SELECT * FROM Talent WHERE ClassID = 1 AND SpecID = 1 AND Row = 60) AS c
- CROSS JOIN (SELECT * FROM Talent WHERE ClassID = 1 AND SpecID = 1 AND Row = 90) AS d
- CROSS JOIN (SELECT * FROM Talent WHERE ClassID = 1 AND SpecID = 1 AND Row = 100) AS e
- CROSS JOIN (SELECT
- a.[ID] AS Trait1ID
- ,b.[ID] AS Trait2ID
- ,c.[ID] AS Trait3ID
- FROM (SELECT ID FROM Trait WHERE ClassID = 1 AND SpecID = 1) AS a --Cross join all traits for the spec
- CROSS JOIN (SELECT ID FROM Trait WHERE ClassID = 1 AND SpecID = 1) AS b
- CROSS JOIN (SELECT ID FROM Trait WHERE ClassID = 1 AND SpecID = 1) AS c
- WHERE a.[ID] <= b.[ID] AND b.[ID] <= c.[ID] --But only return those in ascending ID order so 1,1,2 is returned without using 2,1,1 or 1,2,1
- ) AS f
- CROSS JOIN (SELECT * FROM [Results]
- WHERE [Talent1ID] IS NULL AND [Talent2ID] IS NULL AND [Trait1ID] IS NULL
- AND [Trait2ID] IS NULL AND [ClassID] = 1 AND [SpecID] = 1) AS rb --Include base DPS value
- LEFT JOIN [Talent] AS L15 ON L15.[ID] = a.[ID]
- LEFT JOIN [Talent] AS L30 ON L30.[ID] = b.[ID]
- LEFT JOIN [Talent] AS L60 ON L60.[ID] = c.[ID]
- LEFT JOIN [Talent] AS L90 ON L90.[ID] = d.[ID]
- LEFT JOIN [Talent] AS L100 ON L100.[ID] = e.[ID]
- LEFT JOIN [Trait] AS t1 ON t1.[ID] = f.[Trait1ID]
- LEFT JOIN [Trait] AS t2 ON t2.[ID] = f.[Trait2ID]
- LEFT JOIN [Trait] AS t3 ON t3.[ID] = f.[Trait3ID]
- LEFT JOIN [Results] AS r15 ON r15.[Talent1ID] = a.[ID] AND r15.[Talent2ID] IS NULL AND r15.[Trait1ID] IS NULL AND r15.[Trait2ID] IS NULL --Return the individual talent/trait result rows
- LEFT JOIN [Results] AS r30 ON r30.[Talent1ID] = b.[ID] AND r30.[Talent2ID] IS NULL AND r30.[Trait1ID] IS NULL AND r30.[Trait2ID] IS NULL
- LEFT JOIN [Results] AS r60 ON r60.[Talent1ID] = c.[ID] AND r60.[Talent2ID] IS NULL AND r60.[Trait1ID] IS NULL AND r60.[Trait2ID] IS NULL
- LEFT JOIN [Results] AS r90 ON r90.[Talent1ID] = d.[ID] AND r90.[Talent2ID] IS NULL AND r90.[Trait1ID] IS NULL AND r90.[Trait2ID] IS NULL
- LEFT JOIN [Results] AS r100 ON r100.[Talent1ID] = e.[ID] AND r100.[Talent2ID] IS NULL AND r100.[Trait1ID] IS NULL AND r100.[Trait2ID] IS NULL
- LEFT JOIN [Results] AS rt1 ON rt1.[Trait1ID] = f.[Trait1ID] AND rt1.[Trait2ID] IS NULL AND rt1.[Talent1ID] IS NULL AND rt1.[Talent2ID] IS NULL
- LEFT JOIN [Results] AS rt2 ON rt2.[Trait1ID] = f.[Trait2ID] AND rt2.[Trait2ID] IS NULL AND rt2.[Talent1ID] IS NULL AND rt2.[Talent2ID] IS NULL
- LEFT JOIN [Results] AS rt3 ON rt3.[Trait1ID] = f.[Trait3ID] AND rt3.[Trait2ID] IS NULL AND rt3.[Talent1ID] IS NULL AND rt3.[Talent2ID] IS NULL
- LEFT JOIN [Results] AS s1530 ON s1530.[Talent1ID] = a.[ID] AND s1530.[Talent2ID] = b.[ID] --Add in talent/trait pairs
- LEFT JOIN [Results] AS s1560 ON s1560.[Talent1ID] = a.[ID] AND s1560.[Talent2ID] = c.[ID]
- LEFT JOIN [Results] AS s1590 ON s1590.[Talent1ID] = a.[ID] AND s1590.[Talent2ID] = d.[ID]
- LEFT JOIN [Results] AS s15100 ON s15100.[Talent1ID] = a.[ID] AND s15100.[Talent2ID] = e.[ID]
- LEFT JOIN [Results] AS s15t1 ON s15t1.[Talent1ID] = a.[ID] AND s15t1.[Trait2ID] = f.[Trait1ID]
- LEFT JOIN [Results] AS s15t2 ON s15t2.[Talent1ID] = a.[ID] AND s15t2.[Trait2ID] = f.[Trait2ID]
- LEFT JOIN [Results] AS s15t3 ON s15t3.[Talent1ID] = a.[ID] AND s15t3.[Trait2ID] = f.[Trait3ID]
- LEFT JOIN [Results] AS s3060 ON s3060.[Talent1ID] = b.[ID] AND s3060.[Talent2ID] = c.[ID]
- LEFT JOIN [Results] AS s3090 ON s3090.[Talent1ID] = b.[ID] AND s3090.[Talent2ID] = d.[ID]
- LEFT JOIN [Results] AS s30100 ON s30100.[Talent1ID] = b.[ID] AND s30100.[Talent2ID] = e.[ID]
- LEFT JOIN [Results] AS s30t1 ON s30t1.[Talent1ID] = b.[ID] AND s30t1.[Trait2ID] = f.[Trait1ID]
- LEFT JOIN [Results] AS s30t2 ON s30t2.[Talent1ID] = b.[ID] AND s30t2.[Trait2ID] = f.[Trait2ID]
- LEFT JOIN [Results] AS s30t3 ON s30t3.[Talent1ID] = b.[ID] AND s30t3.[Trait2ID] = f.[Trait3ID]
- LEFT JOIN [Results] AS s6090 ON s6090.[Talent1ID] = c.[ID] AND s6090.[Talent2ID] = d.[ID]
- LEFT JOIN [Results] AS s60100 ON s60100.[Talent1ID] = c.[ID] AND s60100.[Talent2ID] = e.[ID]
- LEFT JOIN [Results] AS s60t1 ON s60t1.[Talent1ID] = c.[ID] AND s60t1.[Trait2ID] = f.[Trait1ID]
- LEFT JOIN [Results] AS s60t2 ON s60t2.[Talent1ID] = c.[ID] AND s60t2.[Trait2ID] = f.[Trait2ID]
- LEFT JOIN [Results] AS s60t3 ON s60t3.[Talent1ID] = c.[ID] AND s60t3.[Trait2ID] = f.[Trait3ID]
- LEFT JOIN [Results] AS s90100 ON s90100.[Talent1ID] = d.[ID] AND s90100.[Talent2ID] = e.[ID]
- LEFT JOIN [Results] AS s90t1 ON s90t1.[Talent1ID] = d.[ID] AND s90t1.[Trait2ID] = f.[Trait1ID]
- LEFT JOIN [Results] AS s90t2 ON s90t2.[Talent1ID] = d.[ID] AND s90t2.[Trait2ID] = f.[Trait2ID]
- LEFT JOIN [Results] AS s90t3 ON s90t3.[Talent1ID] = d.[ID] AND s90t3.[Trait2ID] = f.[Trait3ID]
- LEFT JOIN [Results] AS s100t1 ON s100t1.[Talent1ID] = e.[ID] AND s100t1.[Trait2ID] = f.[Trait1ID]
- LEFT JOIN [Results] AS s100t2 ON s100t2.[Talent1ID] = e.[ID] AND s100t2.[Trait2ID] = f.[Trait2ID]
- LEFT JOIN [Results] AS s100t3 ON s100t3.[Talent1ID] = e.[ID] AND s100t3.[Trait2ID] = f.[Trait3ID]
- LEFT JOIN [Results] AS st1t2 ON st1t2.[Trait1ID] = f.[Trait1ID] AND st1t2.[Trait2ID] = f.[Trait2ID]
- LEFT JOIN [Results] AS st1t3 ON st1t3.[Trait1ID] = f.[Trait1ID] AND st1t3.[Trait2ID] = f.[Trait3ID]
- LEFT JOIN [Results] AS st2t3 ON st2t3.[Trait1ID] = f.[Trait2ID] AND st2t3.[Trait2ID] = f.[Trait3ID]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement