Skip to content
Advertisement

Mysql Complex Where Clause

I really surprised when I tried below code in MySQL:

It doesn’t work. I need to get product that is both free_shipping is ‘yes’ AND price equal ‘5’ at the same time. How can I create this query properly?

Table Structure:

contents: (TABLE 1)

content_fields: (TABLE 2)

Example (Get product that has 1 ID and its shipping is FREE):

Advertisement

Answer

Your current query is contradictory as a single row can never match the WHERE clause. I assume you want something like this.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement