Сначала я создаю новый результат таблицы из distinc
таблицы A.
create table c AS<br>
select distinct po, plan_ref from A group by po, plan_ref
After that, copy the table A. Let say it begin table B.
delete all the data in table A.
`INSERT INTO A (id, po
, plan_ref
, cust_order
, cust_code
, cust_name
, destination
, art_no
, art_name
, cust_reqdate
, posdd
, podd
, ship_date
, container
, ship
, plant_cell
, cbm
, remark
, upload_by
, upload_date)
select MAX(a.id), MAX (a.po)
, MAX(a.plan_ref)
, MAX(a.cust_order)
, MAX(a.cust_code)
, MAX(a.cust_name)
, MAX(a.destination)
, MAX(a.art_no)
, MAX(a.art_name)
, MAX(a.cust_reqdate)
, MAX(a.posdd)
, MAX(a.podd)
, MAX(a.ship_date)
, MAX(a.container)
, MAX(a.ship)
, MAX(a.plant_cell)
, MAX(a.cbm)
, MAX(a.remark)
, MAX(a.upload_by)
, MAX(a.upload_date) from C b
inner join B a on a.plan_ref = b.plan_ref
AND a.po = b.po GROUP BY a.po`