It's a query I'm trying to make for Virtuemart ecommerce platform.
In the query, table virtuemart_product_customfields is joined with LEFT JOIN as table 'cft'.
Table virtuemart_product_customfields:
From table cft, I want the records that have: virtuemart_custom_id= 3 AND customfield_value=Fashion.
SELECT FROM cft
WHERE virtuemart_custom_id= 3 AND customfield_value=Fashion
It fetches me Records 1, 4 and 6. Correct.
From table cft, I want the records that kave field Mechanism='Solar': virtuemart_custom_id=4 AND customfield_value=Solar
SELECT FROM cft
WHERE virtuemart_custom_id=4 AND customfield_value=Solar
It fetches me Records 3 and 8. Correct.
I want a single query that takes two criteria, e.g bring me the records that have:
-Type=Fashion (virtuemart_custom_id=3 AND customfield_value=Fashion) and
-Mechanism=Solar (virtuemart_custom_id=4 AND customfield_value=Solar):
SELECT FROM cft
WHERE virtuemart_custom_id= 3 AND customfield_value=Fashion
virtuemart_custom_id= 4 AND customfield_vaFashionlue=Solar
But of course, this fetches no records, as no record can 'pass' these 4 criteria.
So, how will I get the records that have Type=Fashion and