- Thai Cosmetic Cluster Trade Association -
- สมาคมการค้าคลัสเตอร์เครื่องสำอางไทย -
SELECT SQL_CALC_FOUND_ROWS customers.id, customers.member_type, customers.sub_type, customers.company_logo, customers.company_name
, customers.slug, customers.first_name, customers.last_name, customers.phone, customers.mobile, customers.email
, customers.designation, customers.ntn, customers.website, customers.dob, customers.photo
, customers.city, customers.state, customers.country, customers.status, customers.package_id, customers.package_status
, customers.short_name, customers.falcon_profile_url, customers.profile_photo
, is_completed, profile_access
, (
(customers.company_name = 'Ginseng White Clay Mask') * 100
+ (customers.company_name LIKE 'Ginseng White Clay Mask%') * 50
+ (customers.company_name LIKE '%Ginseng White Clay Mask%') * 20
+ (search.keyword LIKE '%Ginseng White Clay Mask%') * 5
+ (search.keyword LIKE '%Ginseng%') * 2
+ (search.keyword LIKE '%White%') * 2
+ (search.keyword LIKE '%Clay%') * 2
+ (search.keyword LIKE '%Mask%') * 2
) AS relevance
FROM customers
LEFT JOIN customer_own_products ON (customer_own_products.created_by=customers.id)
LEFT JOIN customer_products ON (customers.id = customer_products.customer_id)
LEFT JOIN products ON (products.id = customer_products.product_id)
LEFT JOIN search ON (customers.id = search.member_id)
WHERE 1 AND customers.status='Active'
AND customers.member_type IN('Basic', 'Standard', 'Premium', 'Premium Plus')
AND customers.parent_id = 0
AND ((products.title LIKE '%Ginseng%' OR products.keywords LIKE '%Ginseng%' OR customer_own_products.title LIKE '%Ginseng%' OR customer_own_products.keywords LIKE '%Ginseng%') AND (products.title LIKE '%White%' OR products.keywords LIKE '%White%' OR customer_own_products.title LIKE '%White%' OR customer_own_products.keywords LIKE '%White%') AND (products.title LIKE '%Clay%' OR products.keywords LIKE '%Clay%' OR customer_own_products.title LIKE '%Clay%' OR customer_own_products.keywords LIKE '%Clay%') AND (products.title LIKE '%Mask%' OR products.keywords LIKE '%Mask%' OR customer_own_products.title LIKE '%Mask%' OR customer_own_products.keywords LIKE '%Mask%'))
GROUP BY customers.id
ORDER BY FIELD(customers.member_type,'Premium Plus','Premium','Standard','Basic'), relevance DESC, customers.ordering ASC
LIMIT 0,20
Companies matching “Ginseng White Clay Mask”