Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003

    Unanswered: Update query problem..

    Hey folks silly query question.

    UPDATE tblDMInfo
    SET rel_office_code = OC.objid
    FROM tblDMInfo DM, tblOfficeCode OC
    WHERE DM.rel_office_code = OC.import_id

    I know that works to do a joined update, but what I really need to do is an aggregate joined update...

    kinda like this

    Update tblAvailCases
    set assoc_sent = count(SD.objid)
    from tblSurveyData SD
    where tblAvailCases.assoc_id = SD.assoc_id
    group by SD.assoc_id

    But I'll confess I don't know how.

    Thanks, Rob

  2. #2
    Join Date
    Nov 2003
    For those of you that are curious, the solution is...

    UPDATE tblAvailCases SET assoc_sent = SDSent FROM tblAvailCases AC, (select count(*) [SDSent],assoc_id [SDAssocID] from tblSurveyData group by assoc_id) alAssocCount WHERE AC.assoc_id = alAssocCount.SDAssocID

Posting Permissions

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