| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Paul DuBois | Date: | December 20 2002 1:07pm |
| Subject: | Re: INSERT INTO from a SELECT does not work? | ||
| View as plain text | |||
At 9:30 +0100 12/20/02, Thierry Michalowski wrote: >Hello, > >I'm trying to run the following SQL statement on a table of my MySQL DB: > >insert into MYTABLE(ID, VALUE, SORTKEY) > select T.ID, 'to to', MAX(T.SORTKEY) + 1 from MYTABLE as T group by >T.ID You can't insert into the same table that you're selecting from. This is in the manual. You could select into a temp table, then select that into your original table.
| Thread | ||
|---|---|---|
| • INSERT INTO from a SELECT does not work? | Thierry Michalowski | 20 Dec |
| • Re: INSERT INTO from a SELECT does not work? | Paul DuBois | 20 Dec |
| • re: INSERT INTO from a SELECT does not work? | Egor Egorov | 20 Dec |
