SELECT cf_prod.*, prod.*, prod.disp_order AS sort_order
FROM s01_Products prod left join
(
SELECT cfmp.product_id, CONCAT(cfmp.value, cfmp.value_long) AS combined
FROM s01_CFM_ProdValues cfmp
WHERE (cfmp.field_id = 4) OR (cfmp.field_id =6)
) AS cf_prod on cf_prod.id=prod.id
WHERE (prod.active=1) AND ( prod.id = cf_prod.product_id ) AND
(
( CONCAT(prod.code,prod.name,prod.descrip,cf_prod.combined) LIKE '%BACK%' )
AND
( CONCAT(prod.code,prod.name,prod.descrip,cf_prod.combined) LIKE '%STONES%')
)
ORDER BY sort_order
|