Bonjour,
I would like to create an SQL query for my Laravel project. To explain you a little bit my 2 tables.
I have a "products" table. In this table, I have a primary key > products_id. I also have a "status" column that specifies if the products_id is "for sale" or "for rent".
I have a second table "products_criteres". In this table, the primary key is > products_id I have a "criteres_id" column that must be = "30".
So I would like to get all the products_id that are = "30" in the "products_criteres" table and the "status" column to be equal to "for sale" in the "products" table.
I tried something like this, but nothing works:
SELECT products_main_criteres_history.products_id,date,criteres_id
FROM products_main_criteres_history LEFT JOIN products ON products_main_criteres_history.products_id = products_id
WHERE products_main_criteres_history.criteres_id = 30
WHERE products.status = "a vendre"