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.?

4

1 回答 1

1

您的问题非常模糊,但是您可能正在寻找类似的东西:

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

如果这不是您要查找的内容,则需要更加具体(例如,使用表结构和数据的示例)。

于 2013-01-29T08:26:25.563 回答