Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
SQL query
Revathi Parvathi
Dec 13 2017 2:11 AM
192
Reply
Hi,
I got the below-mentioned output based on the query.I want to show only one Tammy Hanson and sum of Commission paid for this .Is it posible.Please any one help me.
output and query:
Vendor
Date
of
Last
Check
Date
of
check
for
month
Amount
Sales Rep
Commission
Boston Warehouse 12/12/2017 12/12/2017 919.00
NULL
Tammy Hanson 183.80
Woodlink 12/12/2017 12/12/2017 979.86
NULL
Tammy Hanson 195.97
SELECT
Vendor,
CASE
WHEN
CONVERT
(
varchar
(50), DateModified, 101)=
'01/01/1900'
THEN
''
ELSE
CONVERT
(
varchar
(50), DateModified, 101)
end
as
'Date of Last Check'
,
CASE
WHEN
CONVERT
(
varchar
(50), PaycommissionDate, 101)=
'01/01/1900'
THEN
''
ELSE
CONVERT
(
varchar
(50), PaycommissionDate, 101)
end
AS
'Date of check for month'
,
SUM
([Original $ Total])
'Amount'
,
NULL
,[Sales Rep],
SUM
([Commission $ paid])
'Commission $ paid'
from
Tbl_Commission_Reconcilation
where
Vendor
is
not
null
and
Month
([
Order
Date
])=
MONTH
(Getdate())
group
by
Tbl_Commission_Reconcilation.Vendor,
CONVERT
(
varchar
(50), DateModified, 101),[Sales Rep],PaycommissionDate
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
How to compare two query result and create one dynamic colum
.net core 2.0 Invoice Master and Invoice details samplecode