• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mysql request problem

#5
Thank you for your help.
I have reconsidered all my request and now it is working properly. That's what I did as a request:

Code:
SELECT products.id, products.reference, products.label, products.category, products.image, stocks.id_warehouse, (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 qty, SUM(CASE WHEN stocks_alert.id_product = stocks.id_product  THEN stocks_alert.qty_alert ELSE 0 END) as qty_alert FROM products LEFT JOIN stocks ON stocks.id_product = products.id LEFT JOIN stocks_alert ON stcks_alert.id_warehouse = stocks.id_warehouse 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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.