🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Update one table based on data in another

#748
From: Paul
Date: Mon, 25 Jun 2007 21:58
38 lines
1987 bytes
This (at first) sounds simple, anad maybe is. However, I am unable to
find any exampleof how to accomplish it. Here is what I am attempting
to do..

1. Two Tables Identical in structure. I would like to use one table to
update all the columns / fields in the other. 
2. Would link tables on key fields account_ref

I have tried this, but fails with the error (from IbConsole) ...
"ISC ERROR CODE:335544652

ISC ERROR MESSAGE:
multiple rows in singleton select"

//=============================================
UPDATE CUSTOMERS
SET NAME = (SELECT customers.name
FROM customers,customers_imported
WHERE customers.account_ref = customers_imported.account_ref)
WHERE EXISTS
  ( SELECT customers.account_ref
    FROM customers,customers_imported
    WHERE customers.account_ref = customers_imported.account_ref);
//=============================================

Even if this works, it seems overly-complicated and would only update
one field. I would like to update all fields while linking them on the
account_ref field(s)

Any help would be much appreciated..

Many thanks..

Paul.

OS : Windows XP Service Pack 2
Delphi : 2005 Service Pack 3 Installed
CPU : AMD 3500+
Technical Details
Message-ID: <bec083t4td4iqapnt5pu2sm66tp172oudu@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,2270d561f33be473,start
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Paul <nospam@sdiespammersdie.com>
Newsgroups: borland.public.interbase.sql
Subject: Update one table based on data in another
Date: Mon, 25 Jun 2007 22:58:21 +0100
Organization: None
Message-ID: <bec083t4td4iqapnt5pu2sm66tp172oudu@4ax.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.130.190.174
X-Trace: newsgroups.borland.com 1182808699 86.130.190.174 (25 Jun 2007 14:58:19 -0700)
Lines: 38
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail