0

There is table from which I need to select some data based on date criteria which I can do after that need to insert the same data in the same table with the value of one of the columns which is also a key field needs to be changed before insertion.

The Columns of the table are like:

1st key, 2nd key, 3rd key, 4th column,.....26th column, row_update_time, last_upd_user_id, row_create_tm_, row_create_usid.

Now I need to retrieve the data which were updated after a certain date and then insert the same data in this table with a different 2nd key and row_update_time as current time.

I am able to select all the data based on the date criteria and it is retrieving nearly 300 rows. How can I insert with modification in a single shot?

Can any one please help me in this.?

Shubhra
  • 9
  • 1
  • 6
  • 1
    What have you tried so far? What is the structure of your table? You need to add as much information as possible so that people here could help you better.. – Ivan Ferić Jan 29 '13 at 08:42

1 Answers1

1

Your question is very vague, but something like this might be what you are looking for:

insert into the_table (id, some_column, other_column)
select id * 2, some_column, 'foobar'
from the_table
where id = 1;

If this is not what you are looking for you need to be a lot more specific (e.g. with examples of your table structure and data).