Results 1 to 5 of 5
  1. #1
    pradeep.sands is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    49

    Question combining records(rows)

    I am working on a task and I am stuck at a point where I need to combine two or more records(rows).


    I have a query table designed with SQL coding and derived/linked from several other tables...it looks like this..

    Attachment 12686

    Now I need to combine those rows, so that my query table looks like this:
    Attachment 12685

    Can some one suggest me what I can do?

  2. #2
    pradeep.sands is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    49
    Forgot to mention, I am working with SQL design in Access2010...and Not using VBA !!!
    Thanks

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    If a check box is FALSE, the value is zero. If a check box is TRUE, the value is "Not Zero". Therefore, a TRUE check box can be -1, 100, 54.2, -21.87, ...

    In your case, you can the sum of the Machine1 field will be -1 (TRUE). So you can use a totals query.

    Here is the query:
    Code:
    SELECT Sands.Number, Sands.desc, Sands.Parameter1, Sands.Parameter2, Sands.Parameter3, Sands.Parameter4, Sum(Sands.Machine1) AS SumOfMachine1, Sum(Sands.Machine2) AS SumOfMachine2, Sum(Sands.Machine3) AS SumOfMachine3, Sum(Sands.Machine4) AS SumOfMachine4
    FROM Sands
    GROUP BY Sands.Number, Sands.description, Sands.Parameter1, Sands.Parameter2, Sands.Parameter3, Sands.Parameter4;
    ****Change the table name to your name.

    Also, "Number" is a reserved word in Access and shouldn't be used as object names.
    (Here is a list of reserved words http://allenbrowne.com/AppIssueBadWord.html )

  4. #4
    pradeep.sands is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    49
    Hi ssanfu,
    Firstly thanks for your reply.
    Actualy I already have designed a query with SQL. The part you told me to do is actually my sub-query part (I should make it something like a sub-select). So when I do it, it says something like my sub-select has more than one parameter to return and it's not possible.

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The query is a totals query. The Totals row (in design view) for the field "Desc" changed from "Group By" to "Expression", which caused the error.

    See attached zip (A2000 format)

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

Similar Threads

  1. combining rows.. again
    By jerryb in forum Access
    Replies: 16
    Last Post: 05-03-2012, 08:34 PM
  2. Combining rows in query?
    By rev in forum Queries
    Replies: 2
    Last Post: 04-23-2012, 08:47 AM
  3. Combining rows
    By Bing in forum Queries
    Replies: 1
    Last Post: 06-09-2011, 12:54 PM
  4. Combining value in multiple rows into new field
    By stricklanpbs in forum Access
    Replies: 4
    Last Post: 05-05-2011, 11:29 AM
  5. Combining columns into rows
    By steeveepee33 in forum Queries
    Replies: 5
    Last Post: 04-30-2009, 09:18 PM

Tags for this Thread

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