lundi 13 juin 2016

Search in MYSQL with three tables

This is my tables structures:

enter image description here

What i want:

  • Get the productCode of the products that they hold the following conditions:
  • (methodId = 3 AND value < 30) AND (methodId = 4 AND value < 5)

actually the output need to be: The row:

enter image description here

Because in products_has_methods table for the productCode CN306 there is

(methodId = 3 AND value < 30) AND (methodId = 4 AND value < 5)

If i change the conditions to:

(methodId = 3 AND value < 30) AND (methodId = 4 AND value < 2)

i will get nothing.

Tnx a lot

Aucun commentaire:

Enregistrer un commentaire