For MySQL
SELECT date_format(FROM_UNIXTIME(t.date), '%b-%y') as mnth, SUM(plan_price) FROM transations AS t INNER JOIN payplans AS p ON t.plan = p.plan WHERE t.status = '1' GROUP BY mnth;
- You converting unix_timestamp to date using
FROM_UNIXTIME
- formatting it into 'MON-YY' format with
DATE_FORMAT
- then grouping by month.