Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    36

    Unanswered: SELECT AS problems

    I have a table with Student birthdates. I calc a field called age. However, what I really want to graph are age ranges. I have tried to say Select student.age as Age25, student.age as Age25-50, student.age as Age50 from Student where Age25<=25 and Age25-50 Between 25 and 50 and Age50<50.

    However, when I try this, Access interprets the alias names as new fields and expects me to enter what it thinks are parameters called Age25, Age25-50 and Age50.

    Any suggestions?

  2. #2
    Join Date
    Oct 2002
    Posts
    61

    Re: SELECT AS problems

    Try this sql:

    SELECT Name,
    Count(IIf([Age]<"25",[Age])) AS LT25,
    Count(IIf([Age] Between "25" And "50",[Age])) AS 25to50,
    Count(IIf([Age]>"50",[Age])) AS GT50
    FROM Student;


    The first Count will count all ages less than 25 (LT25), the next one will count all ages between 25 and 50 (25to50) and the last on will count all ages greater than 50 (GT50).

    I Hope this is what you were looking for!

    Cheers

  3. #3
    Join Date
    Apr 2003
    Posts
    36

    Re: SELECT AS problems

    Originally posted by Chumpie999typla
    Try this sql:


    I Hope this is what you were looking for!

    Cheers
    Exactly! (except minus the quotes around the age range numbers)

Posting Permissions

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