insert

Post

Posts tagged as "insert"

Comments   |   SQL
Use MAX() with INSERT query

Use MAX() with INSERT query

Hi, today I ran into a problem - I had to use the MAX() function while Inserting data into database. I write a simple query: INSERT INTO `table` (row1,row2) VALUES(`sample`,MAX(row2)+1) And I got an error #1111 – Invalid use of group function So I start to think and find the right way to compose my query: INSERT INTO `table` (row1,row2) VALUES(`sample`,(SELECT ...