mysql - What is wrong with this INSERT MAX+1 query? -


i'm having problem query:

insert invoices(invuid, linenumber) values (?, select(select max(linenumber)+1 invoices invuid=?))

it keeps saying: "general error: 1093 can't specify target table 'invoices' update"

your syntax invalid, use insert ... select , remove values part this:

insert invoices(invuid, linenumber)  select ?, max(linenumber)+1 invoices invuid=? 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -