i have 2 table. how to get total records from left table and matched records form right table in mysql? i am using below query but it will get only matched records from two tables.
SELECT post_id,COUNT(post_id) as pid,hostel_id,ht.user_id,hostel_name,
hostel_type,hostel_district,hostel_area,post_date,hostel_rent,hostel_respond,
h_contact_num,created_date,h_food_type
FROM hostels ht
left join histroy hr
ON ht.hostel_id =hr.post_id
WHERE ht.hostel_district=$city_code AND
ht.status='1' AND
hr.post_type='Hostel'
GROUP BY hr.post_id
ORDER by pid DESC