select temptable.id, sum(temptabel.price) as price
from
(select id,price from A union all select id,price from B) as temptable
group by id
order bye id
from
(select id,price from A union all select id,price from B) as temptable
group by id
order bye id
更正为
order by id
或者不要也行
on A.id=B.id
FROM (SELECT id, price
FROM a
UNION
SELECT id, price
FROM B) AS TEMP
GROUP BY id
FROM (SELECT id, price
FROM a
UNION
SELECT id, price
FROM B) AS TEMP
GROUP BY id
FROM (SELECT id, price
FROM a
UNION
SELECT id, price
FROM B) AS TEMP
GROUP BY id______________________________________________________________
SELECT id, SUM(price) AS price
FROM (SELECT id, price
FROM a
UNION
SELECT id, price
FROM B) AS TEMP
GROUP BY id
from (select id ,price from a union id price from b) as temp
group by id
order by id
on A.id=B.id