#1  
Old 20th January 2021, 02:44 AM
Clément Doss
 
Posts: n/a
Default Update table from several tables

Hello everyone!

I hope you're all safe.

Is there any plans on supporting "update a table from another table"?

I'm using a few workarounds but the fact remains, no workarounds is as fast as
having SQL clause to do the job.

(Ex 1: Updating several fields at once)

UPDATE dest_tab tt
SET (tt.code, tt.description) = (SELECT st.code, st.description
FROM source_tab st
WHERE st.id = tt.id)
WHERE EXISTS (SELECT 1
FROM source_tab
WHERE id = tt.id);


(Ex 2: Inline view )
UPDATE (SELECT tt.id,
tt.code,
tt.description,
st.code AS st_code,
st.description AS st_description
FROM dest_tab tt, source_tab st
WHERE tt.id = st.id) ilv
SET ilv.code = ilv.st_code,
ilv.description = ilv.st_description;

Those would help improve the update performance!



  #2  
Old 22nd January 2021, 02:49 AM
jhoehne jhoehne is offline
Junior Member
 
Join Date: Apr 2018
Posts: 10
Default Re: Update table from several tables

There is a SQL standard for this: MERGE

Code:
MERGE INTO dest_tab tt
  USING source_tab st
  ON tt.id = st.id
WHEN MATCHED THEN
  UPDATE SET tt.code = st.code, tt.description = st.description
It would really be nice if NexusDB would support MERGE.


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update multiple fields from 2 similar tables update every field andkeep the records intact updated in one table. lieven nexusdb.public.support.sql 1 7th June 2020 03:38 PM
UPDATE error Mult Column and Blob Fields Tables and Samples Diniz Binaries 0 16th December 2018 11:08 PM
Question on Refresh/Update tables.. Don Miller nexusdb.public.discussions 6 25th March 2012 04:38 AM
How to update multiple fields in one table from another table John Jacobs nexusdb.public.support 0 4th May 2006 05:41 AM
update 2nd table Harry de Boer nexusdb.public.support.sql 5 10th June 2005 09:36 PM


All times are GMT +11. The time now is 12:01 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.