Guest User

Untitled

a guest
Jul 15th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. /* esta consulta me esta devolviendo vacio */
  2.  
  3. --Query para obtener la informacion diaria del proceso de engorde
  4.  
  5. SELECT DATE(DATE_ADD(c.date, INTERVAL f.day DAY)) AS production_date,
  6. IFNULL(SUM(cs.quantity), 0) supply_consumption, s.unit supply_units,
  7. IFNULL(SUM(f.mortality), 0) mortality,
  8. IFNULL(SUM(f.weight), 0) weight
  9. FROM fattens f
  10. JOIN entercalls c ON c.id = f.call_id
  11. JOIN consumes cs ON cs.stage_id = f.id AND cs.stage_type = 'F'
  12. JOIN supplies s ON s.id = cs.supply_id
  13. WHERE c.farm_id = 7
  14. AND s.code IN ('8', '9', '10', '11')
  15. GROUP BY DATE(DATE_ADD(c.date, INTERVAL f.day DAY)), s.unit;
Add Comment
Please, Sign In to add comment