SELECT DISTINCT(p.propid),r.revs, p.reviews,if(p.reviews!="",p.reviews,r.revs) as newrev,p.category_id,category.name as cat_name,p.people_sleep,p.bedrooms,p.bathrooms,p.children,p.airport,p.features,p.pets,p.smoke,p.zip,
p.wheelchair,p.prop_title,p.prop_desc,p.property_type,prop_date,display_calender,other_url_calender,is_feature,p.isilink_coid, p.isilink_prop_id, p.isilink, p.escapia, p.escapia_prop_id, p.min_rate, p.max_rate,p.min_week, p.max_week,p.min_month, p.max_month, p.review_rating, s.offer_start_date as special
FROM property p
LEFT JOIN
(
SELECT propid,count(id) revs
FROM review
WHERE status = 1
GROUP BY propid
) r
ON r.propid = p.propid
LEFT JOIN special_offer s ON ( p.propid = s.propid )
LEFT JOIN category ON (p.category_id=category.id)
LEFT JOIN effective_dates AS ed ON(ed.propId=p.propId)
WHERE p.active IN("yes","d") AND p.category_id IN (2561,9707,2563,2564,2586,2587,2565,2566,2567,2568,2569,2570,2571,2572,2573,2574,2575,2576,2577,2578,2579,2580,2581,2582,2583,2584,2585) AND ( p.bathrooms="3" ) AND p.is_feature >= SYSDATE()
New York City Vacation Rentals, New York City New York Vacation Rental Homes, NYvacationrentals.com