For getting important data date wise SELECT IFNULL(t1.date,t2.date) as date, IFNULL(SentMessages,0) as sentMessage , IFNULL(ReceivedMessages,0) as receivedMessage, IFNULL(BoughtNumbers,0) as BoughtNumbers, IFNULL(ReleasedNumbers,0) as ReleasedNumbers FROM (SELECT DATE(uh.createdDate) as date, SUM(case when STRCMP(`direction`, 'outbound-api') = 0 then 1 else 0 end) as SentMessages, SUM(case when STRCMP(`direction`, 'Inbound') = 0 then 1 else 0 end) as ReceivedMessages FROM `user_history` uh GROUP BY date) t1 LEFT JOIN (SELECT DATE(pn.createdDate) as date, SUM(case when pn.`status` = 1 then 1 else 0 end) as BoughtNumbers, SUM(case when pn.`status` = 9 then 1 else 0 end) as ReleasedNumbers FROM phone_number pn GROUP BY date) t2 ON t1.date=t2.date UNION SELECT IFNULL(t3.date,t4.date) as date, IFNULL(SentMessages,0) as sentMessage , IFNULL(ReceivedMessages,0) as receivedMessage, IFNULL(BoughtNumbers,0) as BoughtNumbers, IFNULL(ReleasedNumbers,0) as ReleasedNumbers FROM (SELECT DATE(uh.createdDate) as date, SUM(case when STRCMP(`direction`, 'outbound-api') = 0 then 1 else 0 end) as SentMessages, SUM(case when STRCMP(`direction`, 'Inbound') = 0 then 1 else 0 end) as ReceivedMessages FROM `user_history` uh GROUP BY date) t3 RIGHT JOIN (SELECT DATE(pn.createdDate) as date, SUM(case when pn.`status` = 1 then 1 else 0 end) as BoughtNumbers, SUM(case when pn.`status` = 9 then 1 else 0 end) as ReleasedNumbers FROM phone_number pn GROUP BY date) t4 ON t3.date=t4.date ORDER BY `date` DESC 14/02 src/src/ApiBundle/Controller/PhoneNumbersController.php src/src/ApiBundle/Controller/v220309/PhoneNumbersController.php src/src/ApiBundle/Models/PhoneNumbersModel.php src/src/ApiBundle/Models/v220309/PhoneNumbersModel.php src/src/ApiBundle/Models/v220309/UserModel.php src/src/AppBundle/Classes/Constant.php src/src/AppBundle/Classes/General.php src/src/AppBundle/Entity/HoldPhoneNumbers.php src/src/AppBundle/Entity/ReusableNumbers.php src/src/AppBundle/Repository/HoldPhoneNumbersRepository.php src/src/AppBundle/Repository/PhoneNumberRepository.php IOS_REUSE_SUBSCRIPTION_COUNTRY_AU_ADDITIONAL_2_YEARLY IOS_REUSE_SUBSCRIPTION_COUNTRY_AU_ADDITIONAL_3_YEARLY IOS_REUSE_SUBSCRIPTION_COUNTRY_FI_ADDITIONAL_2_YEARLY IOS_REUSE_SUBSCRIPTION_COUNTRY_FI_ADDITIONAL_3_YEARLY