Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2005
    Posts
    10

    Unanswered: UPDATE another table using aggregate function

    Here is the example:

    I have two tables. One has Projects with the total amt of hours worked on the project itself. The other is an Employee_Projects table with individual rows of hrs per employee worked on the above referenced projects.

    I need to SUM all the hrs from the Employee_Projects table and GROUP BY project number, then UPDATE the Projects table with the sum of hours where the Project Number from table A matches the Project Number from table B.

    Of course, you cant use an aggregate function in an UPDATE clause, so what would be the easiest way to do this??

    Any help would be much appreciated.

    -C

  2. #2
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    You could aggregate into a derived table, then update from that table.

    -- This is all just a Figment of my Imagination --

  3. #3
    Join Date
    Aug 2005
    Posts
    10
    Never mind, I figured it out. My syntax was a bit off. Thanks anyway!

Posting Permissions

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