SELECT from Sys_user
Results:
The Create_user_uin_tree in the table identifies who created the record.
When creating a new user, the following SQL is available based on the UIn of the currently logged on user and the newly created user uin:
Select concat (ifnull (Create_user_uin_tree,concat ('_',2,' _ '),'|_', ' a', ' _ ') from where uin=2
Results:
Then the modified Create_user_uin_tree's identity SQL is:
UpdateSys_userSetCreate_user_uin_tree=(SelectConcat (Ifnull (Temp. Create_user_uin_tree,concat ('_',2,'_')),'|_',' the',"_") fromSys_userTemp where Temp. UIn=2)whereUIn= the;
Error message:
Error code:1093. You can ' t specify target table ' Sys_user ' for update in FROM clause 0.000 sec
Reason for the answer on the network :
This is not the way to use MySQL. (wait for MySQL to upgrade it). The English error message means that you cannot select some values from the same table first, and then update the table (in the same statement).
Adjusted the following SQL:
UpdateSys_userSetCreate_user_uin_tree=(Select Temp. Tree from(SelectConcat (Ifnull (Create_user_uin_tree,concat ('_', the,'_')),'|_','98',"_") asTree fromSys_userwhereUIn= the)Temp)whereUIn= 98;
I will be a subset,
Select concat (ifnull (Create_user_uin_tree,concat ('_',"the _ '),'|_', '98' as Tree from where uin=$Temp
and then
Select Temp From (subset)
subset so that neither select nor update is the same table. This problem is solved perfectly.
MySQL a more specific problem: You can ' t specify target table ' Sys_user ' for update in FROM clause