SELECT DISTINCT
phone_code,
city_en,
city_zh,
d.name_en, d.name_zh, d.listing_id, d.type, d.address_en, d.address_zh, d.phone, d.city_id, d.listing_id, d.ts_added, d.ts_updated, d.latitude, d.longitude, d.logo, d.status, d.moderated, CASE when name_en like '%hongta%' then 1 else 0 END as titlematch,
SUM(CASE when cat.category_en LIKE '%hongta%' THEN 1 ELSE 0 END) as tagmatch , ROUND(AVG(r.stars)) AS rating, COUNT(DISTINCT r.review_id) AS total_ratings FROM listings_data d
LEFT JOIN listings_i2c i2c ON (i2c.listing_id = d.listing_id)
LEFT JOIN ads_deployments ads ON (ads.listing_id = d.listing_id)
LEFT JOIN listings_cities c ON (c.city_id = d.city_id) LEFT JOIN listings_categories cat ON (i2c.category_id = cat.category_id) LEFT JOIN listings_reviews r ON (r.listing_id = d.listing_id AND r.live = 1 AND r.deleted != 1 AND r.stars > 0) WHERE c.live = 1 AND d.city_id = 1 AND d.status = 1 AND i2c.category_id IN (61, 202, 209, 75, 203, 72, 144, 68, 143, 62, 66, 67, 77, 64, 211, 169, 71, 206, 142, 201, 69, 79, 215, 210, 205, 150, 207, 204, 63, 141, 200, 70, 76, 78, 74, 208, 73, 65) GROUP BY d.listing_id HAVING titlematch >= 1 OR tagmatch >= 1 ORDER BY titlematch DESC, tagmatch DESC, ORDER BY name_en, You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY name_en' at line 9
SELECT DISTINCT
phone_code,
city_en,
city_zh,
d.name_en, d.name_zh, d.listing_id, d.type, d.address_en, d.address_zh, d.phone, d.city_id, d.listing_id, d.ts_added, d.ts_updated, d.latitude, d.longitude, d.logo, d.status, d.moderated, CASE when name_en like '%hongta%' then 1 else 0 END as titlematch,
SUM(CASE when cat.category_en LIKE '%hongta%' THEN 1 ELSE 0 END) as tagmatch , ROUND(AVG(r.stars)) AS rating, COUNT(DISTINCT r.review_id) AS total_ratings FROM listings_data d
LEFT JOIN listings_i2c i2c ON (i2c.listing_id = d.listing_id)
LEFT JOIN ads_deployments ads ON (ads.listing_id = d.listing_id)
LEFT JOIN listings_cities c ON (c.city_id = d.city_id) LEFT JOIN listings_categories cat ON (i2c.category_id = cat.category_id) LEFT JOIN listings_reviews r ON (r.listing_id = d.listing_id AND r.live = 1 AND r.deleted != 1 AND r.stars > 0) WHERE c.live = 1 AND d.city_id = 1 AND d.status = 1 AND i2c.category_id IN (61, 202, 209, 75, 203, 72, 144, 68, 143, 62, 66, 67, 77, 64, 211, 169, 71, 206, 142, 201, 69, 79, 215, 210, 205, 150, 207, 204, 63, 141, 200, 70, 76, 78, 74, 208, 73, 65) GROUP BY d.listing_id HAVING titlematch >= 1 OR tagmatch >= 1 ORDER BY titlematch DESC, tagmatch DESC, ORDER BY name_en LIMIT 0, 20, You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY name_en LIMIT 0, 20' at line 9
“hongta” Listings in Kunming Sports & Fitness - GoKunming