0
This is my output tabe: 
name    SUM(billing.quantity)   SUM(billing.total)  SUM(billing.discount)   SUM(billing.price)
pen       4                        40                 8                                          32
pencil      3                      15                 2                     13
rubber     1                         2                  1                    1

Using :
SELECT productmaster.name, SUM(billing.quantity), SUM(billing.total), SUM(billing.discount), SUM(billing.price) FROM billing AS billing LEFT JOIN productmaster AS productmaster ON (productmaster.id = billing.pid) GROUP BY billing.pid ORDER BY productmaster.name ASC
 My doubt is , my output should be like 
 name   quantity   total     discount     price
 pen      4         40          8           32
pencil    3          15          2          13
rubber     1         2           1           1
How ? Can any one? I need your help?
2
Contributors
3
Replies
20
Views
2 Years
Discussion Span
Last Post by AntonyRayan
0

SELECT productmaster.name, SUM(billing.quantity) AS Quantity, SUM(billing.total) AS Total, SUM(billing.discount) AS Discount, SUM(billing.price) AS Price FROM billing AS billing LEFT JOIN productmaster AS productmaster ON (productmaster.id = billing.pid) GROUP BY billing.pid ORDER BY productmaster.name ASC

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.