MYSQL INSERT SELECT problem

后端 未结 1 1880
感动是毒
感动是毒 2020-12-07 02:56

i have a little difficulty in understanding how to do some INSERT SELECT.

For instance i have two tables.

TABLE : users  

 id | name   | gender  
 1         


        
相关标签:
1条回答
  • 2020-12-07 03:10

    Assuming your variables are already escaped properly and are not subject to SQL injection:

    INSERT
    INTO    website (url, fid)
    SELECT  $site, id
    FROM    users
    WHERE   name = $user
    
    0 讨论(0)
提交回复
热议问题