0

I am using a query that works on my local developement server.

UPDATE file 
    SET file_original_title= (SELECT file_original_title 
                              FROM file 
                              WHERE id_file = ?), 
        file_file= (SELECT file_file 
                    FROM file 
                    WHERE id_file = ?) 
    WHERE id_file = ?

Which copies the title and file from an existing row to a new row. However I am getting the following error:

#1093 - Table 'file' is specified twice, both as a target for 'UPDATE' and as a separate source for data

RiggsFolly
  • 89,708
  • 20
  • 100
  • 143
Bart
  • 1
  • Which MySQL versions are you running use `SELECT VERSION()` and post that also in the question – Raymond Nijland Mar 11 '22 at 17:33
  • Also see [Why should I provide a Minimal Reproducible Example for a very simple SQL query?](https://meta.stackoverflow.com/questions/333952/why-should-i-provide-a-minimal-reproducible-example-for-a-very-simple-sql-query) – Raymond Nijland Mar 11 '22 at 17:37

0 Answers0