Použijte tento dotaz níže:-
CREATE TEMPORARY TABLE t1 (PONumber decimal(18, 2) NOT NULL,POdate date NOT NULL,customername varchar(200) NOT NULL,description varchar(200) NOT NULL);
INSERT INTO t1(PONumber,POdate,customername,description)
select distinct PONumber,POdate,customername,description from tb_po;
select p.PONumber,p.podate,p.customername,p.description,
(select sum(q.deliveryqty) from tb_spb q where p.PONumber=q.PONumber AND p.description = q.description) as Total
from t1 p;
drop table t1;
Poskytne vám požadovaný výstup.