|
**************list
On Thu, Sep 16, 2010 at 11:39 AM, Charles wrote:
how about:
update ClientTable A
set ClientVersion = (select max(CilentVersion) + 1
from ClientTable B
where a.clientID = b.clientID)
where clientID in (select clientID from NewClientTable);
insert into ClientTable (ClientID, ClientName, ClientVersion)
(select ClientID, ClientName, 0
from NewClientTable);
****************
Charles, (or anyone else). I'm looking at Luis' idea for putting this in a
stored procedure. However, I have a small problem with columns on the
insert.
What the procedure is supposed to do :
1. Take the client record, and update its version number from 0 to n+1
where n is the highest version number in the table for that client.
2. Create a new client record, with the same information as the original,
ie with version number 0, but with the name from the NewClientTable.
Now what if other columns exist in a record, say dateofbirth? This
information is not in NewClientTable. It is in the record that has just
been updated to version number n+1. How can I populate the new record with
this dateofbirth?
Thanks.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
Geen virus gevonden in het binnenkomende-bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 9.0.851 / Virusdatabase: 271.1.1/3162 - datum van uitgifte:
09/27/10 08:34:00
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.