'mysql shows count between each group by month and data together
i want to show data like this
data and count between data by month
query i have till now is
SELECT MONTH(Date),Invoice_Type,
count(Case_ID) as 'Count of Case ID' ,
round(sum(Unit_Price),2) as 'Sum of Unit Price'
from
(
SELECT
cast(convert_tz(rlic.dateapproved_c, 'UTC', 'US/Central') AS date) AS 'Date',
(pt.name) AS Invoice_Type,
(lc.case_id_c) AS Case_ID,
(rli.likely_case) AS 'Unit_Price',
c.date_entered AS 'Create Date',
rlic.sale_type_c AS 'Sale level'
FROM
/* JOINS * /
WHERE
/* conditions */
) P
GROUP BY MONTH(Date),Invoice_Type
order by MONTH(Date),Invoice_Type ;
i can genereate data like this only
i tried
SUM(IF(MONTH(Date)=1, round((Unit_Price),2), 0)) AS 'Jan',
SUM(IF(MONTH(Date)=2, round((Unit_Price),2), 0)) AS 'Feb',
count, @total:=@total+count AS total
but this is not working , what more can i try
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


