I have query like this:
SELECT DATE,REGION,COUNT(*)
FROM ALL_ID_DATA
WHERE DATE in (SUBDATE(CURDATE(),1),SUBDATE(CURDATE(),2),SUBDATE(CURDATE(),8))
AND DIRECTION='inbound'
AND REASON_1 = 'complaint'
GROUP BY REGION,DATE DESC
and the result is

What is the right query to display like this capture below

Could somebody help me?
This type of query is known as a
PIVOT. Unfortunately, MySQL doesn’t have aPIVOTfunction, so you will need to replicate the function using aCASEstatement and an aggregate function.If you know the number of columns to transform, then you can hard-code the values:
See SQL Fiddle with Demo.
Then adding this to your existing query, it would be:
OR
Now if you have an unknown number of dates to transform into columns, then you can use prepared statements and your query would be similar to this (See SQL Fiddle with Demo):
Then placing your original query in the prepared statement the final query would be: