[UPHPU] OT: SQL Query Question
Jonathan Grotegut
jgrotegut at gmail.com
Wed May 31 08:49:01 MDT 2006
I know this is off topic but I am hoping someone with more experience
with SQL than myself can help with a problem I am having.
I am STILL working on the DKP system, I got stuck on a Query problem
that I have now finally found the problem I am just unsure how to fix
it. Anyways, my question:
Is it possible to do a query and specify in your query to use a
distinct on a particular field in one of the databases. Basically my
query is as follows:
SELECT
`drops`.`raidID`,
`player`.`playerID`,
`player`.`PlayerName`,
`player`.`PlayerClass`,
`items`.`dkpcost`,
`raidattendence`.`PointsEarned`,
`raidattendence`.`raidID`
FROM
`player`
Inner Join `raidattendence` ON `player`.`playerID` = `raidattendence`.`playerID`
Left Join `drops` ON `raidattendence`.`playerID` = `drops`.`playerID`
AND `raidattendence`.`raidID` = `drops`.`raidID`
Left Join `items` ON `drops`.`itemID` = `items`.`itemID`
WHERE
`player`.`playerID` = 1
ORDER BY
`player`.`PlayerName` ASC
I am doing a sum on `items`.`dkpcost` and another sum on
`raidattendence`.`PointsEarned` because of the way the data is it
when a player gets more than one item on a raid their "Points Earned"
is getting added in multiple times. I need to prevent this from
happening.
Hopefully this makes some sort of sense, any suggestions are appreciated.
TIA,
Jonathan
More information about the UPHPU
mailing list