Results 1 to 6 of 6
  1. #1
    John Wink is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    1

    How to combine row with identical column using ms access query

    Hello I am a worker in a shop and we are exploring MS access so we can use it to store our business transactions. I am not into programming so I am having a hard time understanding the queries.


    These are the content of my table:

    Customer Table:


    --------------------------
    CusomerNo(pk) Name
    1 John Doe
    --------------------------


    Order Table:
    ----------------------------------
    OrderNo(pk) CustomerNo(fk)
    1 1
    ----------------------------------


    OrderLine Table:
    ----------------------------------------------------------
    OrderNo(fk) ProductNo(fk) Quantity TotalPayment
    1 1 2 $20
    1 2 1 $5
    ----------------------------------------------------------


    Product Table:
    -----------------------------------
    ProductNo(pk) ProductName Price
    1 Coffee $10
    2 Ice Tea $5
    ------------------------------------
    So far, using query wizard, I was able to create a query that joins Customer, Order, OrderLine and Product table.

    This is the query:

    SELECT Orders.OrderNo,Orders.ProductName, Orders.Quantity, [Price]*[Quantity] AS TotalPayment
    FROM (Customer INNER JOIN [Order] ON Customer.[CustomerNo] = Order.[CustomerNo]) INNER JOIN Orders ON Order.[OrderNo] = Orders.[OrderNo] ;

    My problem is, I do not know how to 1.) combine orders that have the same OrderNo 2.) concatenate the order's ProductName 3.) add the Quantity and TotalPayment of both order
    To be specific this is how it currently looks like:
    -------------------------------------------------------
    OrderNo ProductName Quantity TotalPayment
    1 Coffee 2 $10
    1 Ice Tea 1 $5
    -------------------------------------------------------

    This is how I want it to be:

    -------------------------------------------------------
    OrderNo ProductName Quantity TotalPayment
    1 Coffee, Ice Tea 3 $25
    -------------------------------------------------------
    Thank you and sorry for my question!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Can you post a copy of the db
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    @June7 - that link doesn't work for me. Can you test it?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    @June7 - doesn't work for me either.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Combobox with identical bound column ID
    By MiniG in forum Forms
    Replies: 2
    Last Post: 01-20-2020, 10:50 AM
  2. Replies: 14
    Last Post: 09-09-2014, 01:30 PM
  3. Replies: 5
    Last Post: 08-22-2014, 05:01 AM
  4. Replies: 3
    Last Post: 04-05-2013, 10:40 PM
  5. Replies: 1
    Last Post: 03-21-2013, 12:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums