Forum Moderators: coopster

Message Too Old, No Replies

Count question

         

mooger35

11:17 pm on Nov 28, 2005 (gmt 0)

10+ Year Member



For some reason I'm having a problem with this. I know it must be easy but I just can't figure it out.

What I have (simplified):

TABLE: `goalinfo`
FIELDS:
goalid
season
gameid
goal
assist1
assist2

In goal, assist1 and assist2 I have the playerid record from my PLAYERS table (playerid, firstname, lastname).

What I would like to do in my query is count the number of times each playerid appears in goal as "G" and the number of times that same playerid shows up in both assist fields as "A" where season = 2005.

Thanks

mooger35

3:49 pm on Nov 29, 2005 (gmt 0)

10+ Year Member



if more info is needed or if I didn't clarify it enough, please let me know.

Thanks

jatar_k

4:05 pm on Nov 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I don't know if you can do multiple counts in one statement, don't really have anything setup here so I could try it

the essence of what you need though is

get the player id

use that id to get the counts

select count(goal) as totalgoals from goalinfo where goal=$id

where $id would be the player id you are using