🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #750

Re: Update one table based on data in another

#750
From: Paul
Date: Tue, 26 Jun 2007 03:29
36 lines
2189 bytes
Ok thanks. Pleased to know its not just me and it is difficult to do
(with respect complexity.)

Given this (and as the app is in Delphi) I think I may elect to just
iterate through both tables and update (synchronise) the data
programatically. Seems in many ways easier (although probably not as
efficient.)

Many thanks..

Paul.


On 25 Jun 2007 16:00:51 -0700, "Bill Todd" <no@no.com> wrote:

>I suspect that you have rows in Customers that do not exist in
>Customers_Imported and that you want to update only those rows in
>Customers that have a matching record in Customers_Imported with the
>values from Customers_Imported. If so, something like the following
>(untested) should work.
>
>Yes, it seems unnecessarily complex to have to repeat the subquery for
>each field but that's what you have to do.
>
>UPDATE CUSTOMERS
>SET NAME = (SELECT customers_imported.name
>FROM customers_imported
>WHERE customers.account_ref = customers_imported.account_ref)
>WHERE EXISTS
>  ( SELECT 1
>    FROM customers_imported
>    WHERE customers.account_ref = customers_imported.account_ref);

OS : Windows XP Service Pack 2
Delphi : 2005 Service Pack 3 Installed
CPU : AMD 3500+
Technical Details
Message-ID: <bov0839c1ajn1k0b8ercnip94med9g05g2@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <bec083t4td4iqapnt5pu2sm66tp172oudu@4ax.com> <46804923$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,2270d561f33be473
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Paul <nospam@sdiespammersdie.com>
Newsgroups: borland.public.interbase.sql
Subject: Re: Update one table based on data in another
Date: Tue, 26 Jun 2007 04:29:39 +0100
Organization: None
Message-ID: <bov0839c1ajn1k0b8ercnip94med9g05g2@4ax.com>
References: <bec083t4td4iqapnt5pu2sm66tp172oudu@4ax.com> <46804923$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.92/32.572
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 86.145.101.163
X-Trace: newsgroups.borland.com 1182828578 86.145.101.163 (25 Jun 2007 20:29:38 -0700)
Lines: 36
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail