SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    NoVA
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Access] Select fields without grouping by them

    Let's say I have a table with these fields:

    ID, LAST_NAME, FIRST_NAME, PROGRAM_CODE, PGM_YEAR

    And there's at least one entry per person for each year they served. I'm trying to list people who have more than one PGM_YEAR row listed, and I need to list all of those fields in the resulting query.

    So here's what I tried:

    Code:
    SELECT * FROM (
    SELECT LAST_NAME, FIRST_NAME, Count(PGM_YEAR) AS YearsServed
    FROM [Table]
    GROUP BY LAST_NAME, FIRST_NAME, PGM_YEAR)
    WHERE YearsServed > 1;
    I also need to select PROGRAM_CODE but definitely don't want to group by that. Is there a way around that?
    Last edited by tsigo; May 3, 2004 at 09:50.


Bookmarks

Posting Permissions

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