Reputation: 640
When I use this code, its working:
INSERT INTO `js_hdr`(`JO_NO`) SELECT MAX(`JO_NO`) + 1 from `js_hdr`
but when I add columns, its not working, like this:
INSERT INTO `js_hdr`(`TRAN_NO`,`JO_NO`) '1', SELECT MAX(`JO_NO`) + 1 from `js_hdr`
thank you in advance. I'm using Mysql
Upvotes: 0
Views: 85
Reputation: 8818
Try it by removing the '1',
and put it in the SELECT
INSERT INTO `js_hdr`(`TRAN_NO`,`JO_NO`)
SELECT '1',MAX(`JO_NO`) + 1 from `js_hdr`
Upvotes: 3