Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    1

    Unanswered: SELECT multiple question

    Hi folks, thanks for giving this a look -

    I know the following query doesn't work, but it demonstrates what I'm trying to accomplish - query both total points and points for say the month of january in the same query - is this posible? If so, how?

    This is what i would basically like to do more or less -
    SELECT points as total_points, (points as monthly_points WHERE MONTH(ts) = 1) FROM TABLE players

    Any help appreciated!
    Thanks
    Brad

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    select points               as total_points
         , case when month(ts)=1 
                then points 
                else null end   as monthly_points 
      from players
    is there perhaps a SUM to be done here?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •