On Duplicate Key Update Feature In H2
I have developed java desktop application with the use of H2(Embedded). I just have basic knowledge about database, so i simply installed H2 and create a schema name RecordAutomati
Solution 1:
You need to use the MySQL mode. To do that, append ;mode=MySQL to the database URL. (This feature is not properly documented yet).
The table needs to have a primary key or at least a unique index. Complete example:
drop table MREPORT;
set mode MySQL;
create table MREPORT(PRODUCTID int primary key,
DESCRIPTION varchar, QUANTITY int, SUBTOTAL int, PROFIT int);
INSERT INTO MREPORT
(PRODUCTID ,DESCRIPTION ,QUANTITY ,SUBTOTAL ,PROFIT )
VALUES (22,'olper',5,100,260)
ON DUPLICATE KEY UPDATE QUANTITY = QUANTITY+5;
Post a Comment for "On Duplicate Key Update Feature In H2"