Guest User

Untitled

a guest
Oct 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. select sum(tb1.l1)*0.3, sum(tb2.l2)*0.3 from
  2. (select setor, total_geral as l1 from mobile.auditoria
  3. where month(data) = month(now()) and year(data) = year(now())
  4. and setor regexp '[1]' = 1 group by setor order by data) as tb1,
  5. (select setor, total_geral as l2 from mobile.auditoria
  6. where month(data) = month(now()) and year(data) = year(now())
  7. and setor regexp '[2]' = 1 group by setor order by data) as tb2;
  8.  
  9. select sum(tb1.l1)*0.3, sum(tb2.l2)*0.3 from
  10. (select setor, total_geral as l1 from mobile.auditoria
  11. where month(data) = month(now()) and year(data) = year(now())
  12. and setor regexp '[1]' = 1 group by setor order by data) as tb1;
  13.  
  14. select tb1.l1 * 0.3
  15. , tb2.l2 * 0.3
  16. from (
  17. select setor
  18. , sum(total_geral) as l1
  19. from mobile.auditoria
  20. where month(data) = month(now())
  21. and year(data) = year(now())
  22. and setor regexp '[1]' = 1
  23. group by setor
  24. ) as tb1,
  25. (
  26. select setor
  27. , sum(total_geral) as l2
  28. from mobile.auditoria
  29. where month(data) = month(now())
  30. and year(data) = year(now())
  31. and setor regexp '[2]' = 1
  32. group by setor
  33. ) as tb2
Add Comment
Please, Sign In to add comment