0 Replies Latest reply on Aug 21, 2007 9:30 AM by drougge

    update using data from multiple tables

    drougge

      Hello there!

      I'm trying to figure out how to do this in JPQL. It's a pretty straightforward statement but I'm at a loss as of finding any example on how to do this. All example queries I can find are of the very simple sort.

      Here's an example of a multi table update in ordinary SQL. It associates a call with the owner active at the time of that call.

      UPDATE cdr_raw, inventory_anr, anr
      SET cdr_raw.inventory_anrid = inventory_anr.id
      WHERE inventory_anr.anrid = anr.id AND cdr_raw.anr = anr.nr AND cdr_raw.ts >= inventory_anr.stimeframe AND (cdr_raw.ts < inventory_anr.etimeframe OR inventory_anr.etimeframe is null);

      Please, if any of you knows more about this then post a reply here. It would be greatly appreciated. We really like to avoid making native queries as far as possible.

      /Magnus