如何编写查询以从两个表中获取详细信息

如何编写查询以从两个表中获取详细信息

本文介绍了如何编写查询以从两个表中获取详细信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

推荐答案

select a.CustomerName,  SUM(a.TotalAmount) as TotalAmount, SUM(b.PaidAmount ) as PaidAmount
from CustomerDetails a join AmountMaster b on a.CustomerId=b.CustomerId where b.AmountTypeId=1 and b.PaymentToId=2 group by a.CustomerName
order by b.CustomerId


select a.CustomerName, a.TotalAmount, SUM(b.PaidAmount )
from CustomerDetails a join AmountMaster b on a.CustomerId=b.CustomerId
where b.AmountTypeId=1 and b.PaymentToId=2
Group by a.CustomerName, a.TotalAmount



快乐编码!

:)


Happy Coding!
:)


select a.CustomerName, a.TotalAmount, SUM(b.PaidAmount )
from CustomerDetails a join AmountMaster b on a.CustomerId=b.CustomerId where b.AmountTypeId=1 and b.PaymentToId=2 group by a.CustomerName, a.TotalAmount, b.PaidAmount
order by b.CustomerId


这篇关于如何编写查询以从两个表中获取详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 15:52