Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2009
    Posts
    47

    Unanswered: Help with Access SQL-cloumns concatenate

    hi,
    i have project with access form school but iam stuck at a minor stpe rtried some books but no help. i am trying to concatenate three columns into one to create an Index. example

    Column1 column 2 column 3
    243 4231 3432


    output

    Index Column 1 column 2 column 3
    243-4231-3432 243 4231 3432

    i found couple of different format for this but keep getting errors. These columns are in a different table, any help would be appreciated

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    SELECT column1&'-'&column2&'-'&column3 AS [index]
         , column1
         , column2
         , column3
      FROM daTable
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Watch those spaces though. The & symbol needs to have spaces either side.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by StarTrekker
    Watch those spaces though. The & symbol needs to have spaces either side.
    didn't know that

    ta very much

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Feb 2009
    Posts
    47

    Counting multiple columns at same time

    I have received great help form this site, but i ran into kind of a bigger problem. So here is the problem,
    Column 1-----column2-----column3----column4----ID---count1---count2
    1 2 2 2 4
    1 3 3 0 4
    1 2 1 5 4

    values in column 1 are always the same, data was horizontal so i broke it down to vertical form ID shows the row that was broken up.
    Column 2 & 3 are changing values, column 4 is the value the count is to be based off from. if column 4 is a "0" "count 1" increments by 1. and than looking at the ID since there are 2 more rows of same ID "count 2" increments to 2.

Posting Permissions

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