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
Post a Comment