Hello win32,
From documentation I see that I can not use
INSERT ... SELECT with
[ ON DUPLICATE KEY UPDATE ... ]
I have SQL:
insert
into `oborot` (`data_ob`, `data_pr`, `itemno`, `price`, `summa`, `start_amount`,
`amount`, `sklad`)
SELECT
CAST("200312" as UNSIGNED),
`orders_in`.`saledate`,
`orderitems_in`.`itemno`,
`orderitems_in`.`price`,
SUM(`orderitems_in`.`summa`) AS `summa`,
SUM(`orderitems_in`.`amount`) AS `amount_in`,
SUM(`orderitems_in`.`amount`) AS `amount_in`,
`orderitems_in`.`sklad`
FROM
`orders_in`
INNER JOIN `orderitems_in` ON (`orders_in`.`orderno` =
`orderitems_in`.`orderno`)
WHERE
MONTH(`orders_in`.`saledate`) = 12
GROUP BY
`orders_in`.`saledate`,
`orderitems_in`.`itemno`,
`orderitems_in`.`price`,
`orderitems_in`.`sklad`
I would like to update Duplicated rows.
What can I do?
TABLE `oborot` with PRIMARY KEY (`data_ob`,`itemno`,`sklad`,`data_pr`,`price`)