Results 1 to 2 of 2

Thread: Totals query

  1. #1
    Join Date
    Dec 2002
    Phoenix, AZ

    Unanswered: Totals query

    I have an interesting problem. I need to write a query that totals the records in a table. (sounds easy enough). The table is built through a series of update queries. The key field is a manufacter's part number. The remaining fields are different errors that a specific part number can have. So the table ends up looking like this...

    part# error#1 error#2 error#3 error#4
    23421 1 0 0 0
    23437 0 0 0 1
    23421 0 1 0 0

    The update queries add the part number along with that specific error- so its possible to have duplicate part numbers in the table, with different errors. i need to consolidate the duplicates while merging the other fields-so you can see a part number and any error that it may have. I've looked at this so long i think i'm missing something easy. Any ideas

  2. #2
    Join Date
    Sep 2003
    The extremely Royal borough of Kensington, London
    SELECT part#, MAX(error#1), MAX(error#2), MAX(error#3), MAX(error#4)
    FROM tableA
    GROUP BY part#
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

Posting Permissions

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