How to group contents from multiple table and show in single query?

SELECT bookings_category.id AS id,bookings_category.desc_en AS room,COUNT(*) AS cnt FROM bookings_items,bookings_category WHERE bookings_category.id=bookings_items.category AND bookings_category.state=’1′ AND bookings_items.state=’1′ GROUP BY bookings_items.category;

o/p

 

Actual tables

bookings_category

bookings_items

Leave a Reply