Navaz

Navaz

  • NA
  • 96
  • 45.1k

Sql

Dec 17 2014 6:47 AM
SELECT Sales_Master.Customer_Name,
ISNULL(Sales_Master.[Address],'') +','+ ISNULL(Sales_Master.[Address1],'')+','+ ISNULL(Sales_Master.[Address2],'') as 'Customer_Address',
Sales_Master.Customer_ID,
(SUM(Sales_Discount_Point_Details.Points_Earned)-Sum(Sales_Discount_Point_Details.Points_Deducted)) As Points,
[OB_Debit],
[OB_Credit]
FROM Sales_Master
INNER JOIN
Sales_Discount_Point_Details ON Sales_Master.Serial_No = Sales_Discount_Point_Details.Sales_Master_Id
INNER JOIN
Customer ON Customer.Customer_ID =Sales_Master.Customer_ID
Group by
Sales_Master.Customer_Name,
Sales_Master.[Address],
Sales_Master.[Address1],
Sales_Master.[Address2],
Sales_Master.Customer_ID,
[OB_Debit],
[OB_Credit]
End
 
 
how can i group by only  customer Id  

Answers (3)