SQL help needed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone come up with an SQL statement to do the following?

I have a table with a series of records with zero keys representing initial
values. The first time a user goes to update this table I need to duplicate
all these rows but with the real keys in them. So I need someting like this:

BEFORE
Key= 0 Data=0
Key= 0 Data=0
AFTER
Key= 0 Data=0
Key= 0 Data=0
Key= 1 Data=0
Key= 1 Data=0

Yes, the keys do allow duplicates!
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

INSERT INTO table_name (Key, Data)
SELECT 1, Data
FROM table_name
WHERE Key = 0
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ+FC9YechKqOuFEgEQLIfgCcDlxUZTb8TRaw6Wm/EaKnBxWKI0EAoODs
03UDcgTVrK8pXfnHEvI4/C+i
=4ulr
-----END PGP SIGNATURE-----
 
Back
Top