Hi everyone,I'm fairly new to SQL and I'm stuck! I've been banging my head against a wall today trying to figure this out.I have my database which tracks poker stats from our games.I have a game table, attendance table and bonus table.I am trying to get details from all these tables and generate a league from it.This is what I have so far:SELECT player.playerid, attendees.pointsearnedINTO temptableFROM game, player, attendees WHERE player.playerid = attendees.playerid AND attendees.gamedate = game.gamedate AND player.playerid = attendees.playerid AND attendees.leagueyear = '2010' AND pointsearned > 0 AND game.leagueyear = attendees.leagueyearSELECT playerid, SUM(pointsearned)AS PointsFROM temptableGROUP BY playeridORDER BY playerid ASCSELECT bonus.playerid, bonus.gamedateINTO tempbonusFROM bonus, player, gameWHERE bonus.leagueyear = '2010' AND game.gamedate = bonus.gamedate AND player.playerid = bonus.playeridORDER BY bonus.playeridSELECT tempbonus.playerid, COUNT(tempbonus.gamedate)AS TimesWonFROM tempbonusGROUP BY playerid
This gets displays 2 temporary tables, the first displays the playerids that have points and the number of points. The second table displays the players that have bonus points along with the number of bonus points they have.Now, I need to add together the Points column for the playerid and add it to the TimesWon column matching the playerid and populate a third table so that it shows the total points for each player.Unfortunately some players haven't won either any points in the game or not won any bonus points so don't appear in one (or both) of the columns.Does that make sense? I am really stuck!Can anyone help me out? If you need any more info please let me know.Thanks,Premier2k