Reputation: 127
I have this table in my database see attached images
Now what i wanted is to count all the or_number and get the total sales_total with the same sales_date in different sales_branch Here is my sample script:
SELECT *,sum(sales_total) as total,group_concat(DISTINCT or_number) as
orn FROM `tbl_sales` GROUP by sales_date
Which is wrong because it doesn`t count the sales_total and the different sales_branch group into one because the of the sales_date.
Any idea please help.
Upvotes: 0
Views: 56
Reputation: 127
Here is my sql script:
SELECT *,sales_date, sales_branch, COUNT(DISTINCT or_number), SUM(sales_total) AS total_sales FROM tbl_sales GROUP BY sales_date, sales_branch
Upvotes: 1