Hello,
First of all i am not 100% sure if this question is in the right category but this was the only one that mentioned SQL.
I am a bit stuck at a problem with mysql where i hope to get some answers if this is possible. The query below is (part) of a query that we use to check if our stock ( prices_stock, locally ) against the stock that is online on one of our marketplaces ( bol_stock# ).
The problem what i have is how i best can check if it is different for the last 3 times ( bol_stock, bol_stock2 and bol_stock3 ), so in short prices_stock has to be different then bol_stock, bol_stock2 and bol_stock3 before it needs to be added.
I have the query below where i firstly limit the prices_stock (should not matter for the question itself) and then match it against the first stock but i cannot figure out how i can match it against all 3. Is this even possible? I tried googling for this but i only get results back that mention that you just have to add multiple where lines but that does not help.
SELECT
tbl_bolapi_nl_check.sku,
IF(tbl_product_prices.supplier_id = 1 OR tbl_product_prices.supplier_id = 19, IF(tbl_product_prices.stock > 25, 25, tbl_product_prices.stock) , IF(tbl_product_prices.stock > 5, 5, tbl_product_prices.stock)) AS prices_stock,
tbl_bolapi_nl_check.stock AS bol_stock,
tbl_bolapi_nl_check.stock_check2 AS bol_stock2,
tbl_bolapi_nl_check.stock_check3 AS bol_stock3,
tbl_bolapi_nl_check.stock_check4 AS bol_stock4
FROM
`tbl_bolapi_nl_check`
LEFT JOIN tbl_bolapi_nl ON tbl_bolapi_nl.sku = tbl_bolapi_nl_check.sku
LEFT JOIN tbl_product_prices ON tbl_product_prices.sku = tbl_bolapi_nl_check.sku
WHERE
IF(tbl_product_prices.supplier_id = 1 OR tbl_product_prices.supplier_id = 19, IF(tbl_product_prices.stock > 25, 25, tbl_product_prices.stock) , IF(tbl_product_prices.stock > 5, 5, tbl_product_prices.stock)) != tbl_bolapi_nl.stock