2016-02-26 40 views

回答

0

试试这个:

select 
    a.idprice, 
    sum(a.tax) + b.price as sum_price 
from 
    tableA a 
    inner join 
     tableB b on b.idprice = a.idprice 
group by 
    a.idprice, 
    b.price 

SQLFiddle

+0

感谢亲爱的朋友 –

-1

试试这个

Select (Sum(A.tax) + Sum(B.Price)) As Result 
From TableA A Inner Join TableB B on A.idprice = B.idprice 
Group By A.idprice  
0

查询

select t1.tax + t2.price as new_col_name 
from 
(
    select idprice, sum(tax) as tax 
    from table1 
    group by idprice 
) t1 
join table2 t2 
on t1.idprice = t2.idprice; 
+0

感谢亲爱的朋友 –