James Murrell
asked on
working out how to double sum of one round if rounds match
Hi hope you can help I have a query
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
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Give us an example of 'double the points', as that's hard to read when the numbers are 701, 726, 18, and 25.
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.