Home > database >  A SQL statement
A SQL statement

Time:10-16

The same table, I will first check out a batch of data, and then to the data of a certain field changes, and then the modified data inserted into this form, an example with the users table, query out account name for anhui, log in to your account for anhui I'd like to log in to your account fields with CMS, the new data for the account name of anhui login name cmsanhui then put the data inserted into the users table

CodePudding user response:

INSERT INTO userTab
(name and address)
(SELECT the 'CMS' + the name AND address FROM userTab WHRER name='anhui' AND address='XXXX';

CodePudding user response:

INSERT INTO TABLE_NAME
(name,... )
(SELECT the 'CMS' | | name,... The FROM TABLE_NAME WHRER name='anhui';

CodePudding user response:

Why not directly update, the update table
Set a=a | | the username

CodePudding user response:

The update table name set login name='CMS' | | login account where name='anhui'
  • Related