Welcome Guest, Not a member yet? Register   Sign In
Mysql request problem
#3

Thank you for your reply.

I did not know the query binding approach. I will deepen it for my developments.

Yes, my request works perfectly.
My problem is that at one point I have to do some qty_alert to compare it to qty. 
At this moment the result qty becomes false doubles its value.

Here is the query built:

PHP Code:
SELECT products.idproducts.referenceproducts.label, (SUM(CASE WHEN slug IN ('orders''variation''transfer''add'THEN stocks.qty ELSE 0 END) - SUM(CASE WHEN slug ='used' THEN stocks.qty ELSE 0 END)) as qtySUM('qty_alert') AS qty_alert 
FROM products JOIN stocks ON stocks
.id_product products.id JOIN stock_alert ON stocks_alert.id_product stocks.id_product 
WHERE 
products.reference LIKE '%%' ESCAPE '!' OR products.label LIKE '%%' ESCAPE '!' GROUP BY products.id HAVING qty qty_alert
Reply


Messages In This Thread
Mysql request problem - by alain - 02-13-2019, 12:32 AM
RE: Mysql request problem - by php_rocs - 02-13-2019, 09:21 PM
RE: Mysql request problem - by alain - 02-14-2019, 12:19 AM
RE: Mysql request problem - by php_rocs - 02-14-2019, 06:35 AM
RE: Mysql request problem - by alain - 03-20-2019, 11:44 PM
RE: Mysql request problem - by php_rocs - 03-21-2019, 02:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB