TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jes Sie
743
1.2k
280.9k
Aggregate in SQL SERVER
Mar 21 2017 6:22 AM
I have the query below:
SELECT
sum
(c.ConvertedNetPremium + c.ConvertedVAT + c.ConvertedRegistryFee)
as
Due
from
dbo.CashierSalesDetails c
select
sum
(a.AmountPaid)
as
payment
from
dbo.tblAgentPaymentMonitoring a
My requirement is that, I should be able to deduct the "payment" from the "Due". below is the actual data of both tables
I tried this code but the answer is wrong:
SELECT
a.TaxInvoiceNumber,
sum
(a.AmountPaid)
as
payment,
sum
(c.ConvertedNetPremium + c.ConvertedVAT + c.ConvertedRegistryFee)
as
Due,
sum
(a.AmountPaid) -
sum
(c.ConvertedNetPremium + c.ConvertedVAT + c.ConvertedRegistryFee)
as
BAlance
FROM
dbo.tblAgentPaymentMonitoring a
INNER
JOIN
dbo.CashierSalesDetails c
ON
a.TaxInvoiceNumber = c.TaxInvoiceNumber
GROUP
BY
a.TaxInvoiceNumber
Reply
Answers (
7
)
WCF Service Payload ?
Error : '<', hexadecimal value 0x3C, is an invalid attribute