Please delete

  • Question can be deleted.

    Sorry for the newbie shit 😉

    • This topic was modified 2 years, 7 months ago by  bent.
  • My German is not good enough to understand all of your screenshots, and as you have not provided any usable sample code, I cannot provide a coded solution. But I can offer some general advice about how I would structure this.

    If I make the following assumptions:

    1. I have a subquery which contains the results I wish to use to perform the update. In particular, an Id (which will join to the target table) and a value (which is what will be used to update the target table).
    2. The target table needs to contain the Id and the value column.
    WITH src as (SELECT Id, Value etc)  --this is the subquery part
    UPDATE trg
    SET Value = src.Value
    FROM Target trg
    JOIN src on trg.Id = src.Id

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Vielleicht sowas

    with upd_cte(SUM_KBABenoetigteZeit, pm_extended_id) as (
    select sum(TCompl.usr_KBABenoetigteZeit), PMProc.pm_extended_id
    from rm_task_completion TCompl
    join rm_request_task AS RTask ON TCompl.rm_task_guid = RTask.pm_guid
    join rm_request AS REQ ON RTask.rm_request_guid = REQ.pm_guid
    join pm_process AS PMProc ON REQ.pm_guid = PMPROC.pm_guid
    where TCompl.rm_task_guid = RTask.pm_guid
    group by PMProc.pm_extended_id)
    update REQ
    set usr_kbagesamtzeittask = isnull(SUM_KBABenoetigteZeit, 0)
    from rm_request as REQ
    left join upd_cte u on REQ.pm_guid=u.pm_extended_id
    Where REQ.usr_kbagesamtzeittask is NULL
    or REQ.usr_kbagesamtzeittask = 0;

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply