You appear to be using FIND_IN_SET on an integer field (that will not contain a list). If you want to check if the value of that integer field is one of a list of values then faster to use IN
SELECT p . * ,
f . * ,
CASE
WHEN CAST( p.product_special_price AS DECIMAL ) > CAST( p.product_price AS DECIMAL )
THEN CAST( p.product_price AS DECIMAL )
ELSE
CASE WHEN CAST( p.product_special_price AS DECIMAL ) =0
THEN CAST( p.product_price AS DECIMAL )
ELSE CAST( p.product_special_price AS DECIMAL )
END
END AS MinPrice1
FROM crm_products p
JOIN `crm_seller_attributes` sa ON sa.seller_id = p.seller_id
LEFT JOIN `crm_product_filter` f ON p.product_id = f.product_id AND f.seller_id = p.seller_id
WHERE p.seller_id = '63'
AND (f.seller_attribute_id IN (338, 340))
AND (FIND_IN_SET( '737', f.options )
OR FIND_IN_SET( '736', f.options )
OR FIND_IN_SET( '749', f.options ))
AND FIND_IN_SET( '515', p.category_ids )
AND p.product_status = 'Active'
GROUP BY p.product_id
ORDER BY p.product_id DESC
LIMIT 0 , 12
EDIT
It seems you only want a product when it has ALL the selected filters (which isn't the situation in your sample data).
Couple of solutions. Simplest is to just count the distinct attributes and check it is the same as the attributes searched for:-
SELECT p . * ,
f . * ,
CASE
WHEN CAST( p.product_special_price AS DECIMAL ) > CAST( p.product_price AS DECIMAL )
THEN CAST( p.product_price AS DECIMAL )
ELSE
CASE WHEN CAST( p.product_special_price AS DECIMAL ) =0
THEN CAST( p.product_price AS DECIMAL )
ELSE CAST( p.product_special_price AS DECIMAL )
END
END AS MinPrice1
FROM crm_products p
INNER JOIN `crm_seller_attributes` sa ON sa.seller_id = p.seller_id
INNER JOIN `crm_product_filter` f ON p.product_id = f.product_id AND f.seller_id = p.seller_id
WHERE p.seller_id = '63'
AND (f.seller_attribute_id IN (338, 340))
AND (FIND_IN_SET( '737', f.options )
OR FIND_IN_SET( '736', f.options )
OR FIND_IN_SET( '749', f.options ))
AND FIND_IN_SET( '515', p.category_ids )
AND p.product_status = 'Active'
GROUP BY p.product_id
HAVING COUNT(DISTINCT f.seller_attribute_id) = 2
ORDER BY p.product_id DESC
LIMIT 0 , 12
And alternative is to join the table once for each filter. In this case I have moved the checks on the filter to the ON clauses just to make them easier to read.
SELECT p.* ,
f1.* ,
CASE
WHEN CAST( p.product_special_price AS DECIMAL ) > CAST( p.product_price AS DECIMAL )
THEN CAST( p.product_price AS DECIMAL )
ELSE
CASE WHEN CAST( p.product_special_price AS DECIMAL ) =0
THEN CAST( p.product_price AS DECIMAL )
ELSE CAST( p.product_special_price AS DECIMAL )
END
END AS MinPrice1
FROM crm_products p
INNER JOIN `crm_seller_attributes` sa ON sa.seller_id = p.seller_id
INNER JOIN `crm_product_filter` f1 ON p.product_id = f1.product_id AND f1.seller_id = p.seller_id AND f1.seller_attribute_id = 338 AND (FIND_IN_SET( '737', f1.options ) OR FIND_IN_SET( '736', f1.options ) OR FIND_IN_SET( '749', f1.options ))
INNER JOIN `crm_product_filter` f2 ON p.product_id = f2.product_id AND f2.seller_id = p.seller_id AND f2.seller_attribute_id = 340 AND (FIND_IN_SET( '737', f2.options ) OR FIND_IN_SET( '736', f2.options ) OR FIND_IN_SET( '749', f2.options ))
WHERE p.seller_id = '63'
AND FIND_IN_SET( '515', p.category_ids )
AND p.product_status = 'Active'
GROUP BY p.product_id
ORDER BY p.product_id DESC
LIMIT 0 , 12
In either case you have an issue that you are returning all the columns from the filter table but using GROUP BY p.product_id. This will result in one of the rows of matching filters being returned, but which one is not defined.