Any Access gurus out there?

Discussion in 'Techforge' started by Mr. Plow, Jun 11, 2007.

  1. Mr. Plow

    Mr. Plow Fuck Y'all

    Joined:
    Apr 15, 2004
    Messages:
    4,137
    Location:
    Langley Falls, VA
    Ratings:
    +1,409
    Plow needs help. I've got a table with Month, Year, Territory, Order#, and Comment fields. Territory and Comment are text. A query matches the Order# with another table & totals a value on that other table by the Territory. No problems yet. However, I want to comcatenate the comments for each territory into one entry. Anyone know how I can do this? :mystery:
  2. Seth Rich

    Seth Rich R.I.P.

    Joined:
    Jan 9, 2005
    Messages:
    2,387
    Location:
    Hillary's Hit List
    Ratings:
    +1,417
    There's a SQL command called "CONCAT()" that should do what you want.

    Check this out.
  3. Ebeneezer Goode

    Ebeneezer Goode Gobshite

    Joined:
    Mar 28, 2004
    Messages:
    19,127
    Location:
    Manchester, UK
    Ratings:
    +8,259
    do you mean concatenate or group?

    if you want to concatenate and output, you'll need to do some VBScript, if its just group then you need to use SQLs aggregate functions, say:

    Code:
    SELECT territory, comment
    FROM TABLENAME
    WHERE territory=@territory
    GROUP BY territory, comment;
    
    and enter the @territory value when prompted
  4. Mr. Plow

    Mr. Plow Fuck Y'all

    Joined:
    Apr 15, 2004
    Messages:
    4,137
    Location:
    Langley Falls, VA
    Ratings:
    +1,409
    I want to concatenate. I have comments that I want to make into one large comment based on territory. I think SQL is my best bet. Thanks.