insert ... select....
i need to copy an entire row of data and insert it into a new insert command....
i was wondering since this
insert into userdetails select (UserName,FirstName,LastName) from userdetails where CurrentStatus=0;
is not possible (according to the manual) and i tried severay possible variations. now this is only a small example to show what i mean the record itself has 36 cols... at first i tought of doing a select (each field name... 36 alltogether) from userdetails where CurrentStatus=0 and then to do an insert according to the values i got from the select... but to do it for 36 different cols... is there any way to copy entir row into a new record?
thnx in advance.
You need to tell us what database you're using for a start :). Something similar to that is possible with some databases; for example in SQL Server, a query like:
insert into table_1 select field_1, field_2 from table_2 where field_3 = 'blah'
will work just fine :).
This should work for you, it runs on sybase, but there's nothing thats sybase specific (I don't believe) :
insert into Table1 (field1,field2,field3)
(select field1,field2,field3 from
table2 where field4 = "whatever")
Just select the fields in the order that you specify on the insert and run it all together.
Hope that helps,
 Or you can use myphpadmin if you have that, just dump the data from the table and change a few values on the dump file (the new table name, for instance) and populate your new table with it...