Loading ...
Sorry, an error occurred while loading the content.

2166Re: [baseball-databank] MySQL SQL syntax help

Expand Messages
  • Tangotiger
    Jun 14, 2004

      I'm having a heckuva time following the request here
      (though, the A/C is out here, and I can barely focus).

      If you send me an email with your contact number, I
      can call you, and I'm sure we can figure it out.

      (Unless Michael M has already figured it out.)


      --- Derek Adair <dadair@...> wrote:
      > I'm looking for an MySQL-compatible SQL query that
      > will, given a year
      > range and a stat, provide me with either (ideally) a
      > major league average
      > per year for that stat or a result set I can
      > calculate that average from
      > (PlayerID, Year, Stat). I'm running into a few
      > problems. The average needs
      > to be calculated after a grouping by PlayerID, then
      > Year, since I don't
      > want a player with two or more stints getting a
      > lower total averaged in.
      > I'm not sure how to group by two variables, and I
      > don't know how two
      > layers of aggregation can be accomplished (SUM, then
      > AVG). Subqueries
      > would seem to help a bit, but I can't see how to get
      > all the way there,
      > even if I upgrade to 4.1 alpha.
      > Any thoughts?
      > Regards,
      > Derek

      Do you Yahoo!?
      Friends. Fun. Try the all-new Yahoo! Messenger.
    • Show all 6 messages in this topic