Link to home
Start Free TrialLog in
Avatar of James Murrell
James MurrellFlag for United Kingdom of Great Britain and Northern Ireland

asked on

working out how to double sum of one round if rounds match

Hi hope you can help I have a query

SELECT     SUM(res.points) AS points, f1.Driver1
FROM         races AS r INNER JOIN
                      results AS res ON r.raceId = res.raceId INNER JOIN
                      f1users AS f1 ON res.driverId = LEFT(f1.Driver1, 3)
WHERE     (r.year = 2014) AND (f1.submissionID = 51)
GROUP BY f1.Driver1, r.round

Open in new window


which show the total points for a year but what i now need is to double the points if r.round = f1.round  so at mo

it would show

701 Lewis Hamiltion

but new one would show

726 Lewis Hamilton as round 18 matches so he collects a extra 25 points
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Give us an example of 'double the points', as that's hard to read when the numbers are 701, 726, 18, and 25.
Avatar of James Murrell

ASKER

Thanks could not see the wood for the trees on that one
Not necessary instinctive, but now that you've seen that technique, you'll use it easily again in the future.