i want a count for a specific month’s data from my table tbl_itunes_report.
table structure is
id int pimary key
provider_country varchar(50)
title varchar(50)
product_type_identifier varchar(50)
begin_date varchar(50)
This is my query
SELECT
title,
sum(CASE WHEN MONTH(begin_date)= '05' THEN 1 ELSE 0) as june
FROM
tbl_itunes_report
WHERE
`product_type_identifier` = '1T'
group by title
but this query does’nt worked for me. there is an error showing that
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') as june FROM tbl_itunes_report WHERE `product_type_identifier` = '1T' group' at line 3
if any one can help me, please.
thanks in advance
You are missing the END keyword at the end in CASE statement