I've two different queries like
// This query will return past month records
SELECT b.list_id, r.name, r.city, FROM_UNIXTIME(b.bookingdate, '%Y-%m-%d- %h:%i:%s') AS 'bookingdate', COUNT(*) AS bookings
FROM booking b JOIN restaurants r ON r.list_id = b.list_id
WHERE b.bookingdate BETWEEN 1383224400 AND 1385730000 GROUP BY b.list_id
// This query will return current month records
SELECT b.list_id, r.name, r.city, FROM_UNIXTIME(b.bookingdate, '%Y-%m-%d- %h:%i:%s') AS 'bookingdate', COUNT(*) AS bookings
FROM booking b JOIN restaurants r ON r.list_id = b.list_id
WHERE b.bookingdate BETWEEN 1385816400 AND 1388408400 GROUP BY b.list_id
Result fields for both queries list_id, name, city, bookingdate, bookings
I want to combine both query results into one and want result fields like list_id, name, city, bookingdate, bookings_lastmonth, bookings_currentmonth
What is the best way to do this?
JOINhas special meaning in SQL, using that in your title makes this confusing.