MySQL Forums
Forum List  »  Newbie

MySQL query - Virtuemart Custom Fields
Posted by: As Os
Date: December 28, 2017 07:07AM

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

Options: ReplyQuote


Subject
Written By
Posted
MySQL query - Virtuemart Custom Fields
December 28, 2017 07:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.