Database error: Invalid SQL: select distinct e.establishment_id, e.establishment_name, e.establishment_detail, e.guesthouse_listing_desc, if(guesthouse_listing_desc is null, establishment_detail, guesthouse_listing_desc) listing_description, e.link_path_url, e.show_rates_ind, e.book_id, e.nb_indicator, e.bbid, e.bb_room_ids, e.disable_quotes, e.conference_image, e.availability_ind, e.eres_indicator, e.eres_property_code, e.priority_indicator, e.secondary_indicator, e.deprioritise, avg( gr.stay_rating ) average_rating, round(count( gr.stay_rating )/2) count_reviews, ers.min_rate, if(min_rate > 0, 1, 2) rate_order, esumm.tourism_grading star_grading_name, esumm.suburbs, esumm.default_suburb, esumm.default_categories, esumm.categories, esumm.facilities, esumm.extra_fields, rand(dayofyear(current_date())) rand_col from establishment e inner join establishment_suburb es on es.establishment_id = e.establishment_id and es.suburb_id in () inner join establishment_summary esumm on esumm.establishment_id = e.establishment_id left outer join guest_review gr on gr.establishment_id = e.establishment_id and gr.published_ind = 1 and gr.archived_ind is NULL left outer join establishment_rate_summary ers on ers.establishment_id = e.establishment_id and ers.establishment_id = esumm.establishment_id where e.published_ind = 1 and esumm.categories like '%"22"%' group by e.establishment_id, e.establishment_name order by e.deprioritise asc, rate_order, rand_col
MySQL Error: 1064 (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') inner join establishment_summary esumm on esumm.establishment_id = e.establ' at line 36)