× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



probably should have made this clearer

You simply specify all fields except clientid which is replaced by a constant.

Insert into clientfile
select 'CLIENT2', key2, fld3, fld4, ....
from clientfile A
where clientid = 'CLIENT1'
and not exists( select * from clientfile B
where b.clientid = client2
and b.key2 = a.key2
)

HTH,
Charles

On Fri, Nov 12, 2010 at 9:46 AM, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:
Insert into clientfile
 select client2, key2, fld3, fld4, ....
 from clientfile A
 where clientid = client1
    and not exists( select * from clientfile B
                           where b.clientid = client2
                               and b.key2 = a.key2
                         )

HTH,
Charles

On Fri, Nov 12, 2010 at 9:15 AM, David FOXWELL <David.FOXWELL@xxxxxxxxx> wrote:

Can I copy all of client1's records to a new client client2 with SQL?
Ie, copy all the data but with a different clientId supplied by my program.

Something like :

Insert into clientfile
select *from clientfile where clientid = client1 ( but replacing client1 with client2)

How should I protect against duplicate records? Normally the client2 will never exist at this time but you never know!

Thanks.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
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.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.