Revathi Parvathi

Revathi Parvathi

  • NA
  • 323
  • 61.3k

SQL query

Dec 13 2017 2:11 AM
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:
  1. Vendor  Date of Last Check  Date of check for month Amount  Sales Rep      Commission                
  2. Boston Warehouse    12/12/2017  12/12/2017  919.00  NULL    Tammy Hanson    183.80  
  3. Woodlink            12/12/2017  12/12/2017  979.86  NULL    Tammy Hanson    195.97  
  1. SELECT Vendor,CASE WHEN CONVERT(varchar(50), DateModified, 101)='01/01/1900' THEN '' ELSE CONVERT(varchar(50), DateModified, 101) end   
  2.    as 'Date of Last Check'CASE WHEN CONVERT(varchar(50), PaycommissionDate, 101)='01/01/1900' THEN '' ELSE CONVERT(varchar(50), PaycommissionDate, 101) end  
  3.    AS 'Date of check for month',SUM([Original $ Total]) 'Amount',NULL,[Sales Rep],SUM([Commission $ paid]) 'Commission $ paid'  
  4. from Tbl_Commission_Reconcilation  where Vendor is not null and Month([Order Date])= MONTH (Getdate())  
  5. group by Tbl_Commission_Reconcilation.Vendor,CONVERT(varchar(50), DateModified, 101),[Sales Rep],PaycommissionDate  


Answers (3)