Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select sum(tb1.l1)*0.3, sum(tb2.l2)*0.3 from
- (select setor, total_geral as l1 from mobile.auditoria
- where month(data) = month(now()) and year(data) = year(now())
- and setor regexp '[1]' = 1 group by setor order by data) as tb1,
- (select setor, total_geral as l2 from mobile.auditoria
- where month(data) = month(now()) and year(data) = year(now())
- and setor regexp '[2]' = 1 group by setor order by data) as tb2;
- select sum(tb1.l1)*0.3, sum(tb2.l2)*0.3 from
- (select setor, total_geral as l1 from mobile.auditoria
- where month(data) = month(now()) and year(data) = year(now())
- and setor regexp '[1]' = 1 group by setor order by data) as tb1;
- select tb1.l1 * 0.3
- , tb2.l2 * 0.3
- from (
- select setor
- , sum(total_geral) as l1
- from mobile.auditoria
- where month(data) = month(now())
- and year(data) = year(now())
- and setor regexp '[1]' = 1
- group by setor
- ) as tb1,
- (
- select setor
- , sum(total_geral) as l2
- from mobile.auditoria
- where month(data) = month(now())
- and year(data) = year(now())
- and setor regexp '[2]' = 1
- group by setor
- ) as tb2
Add Comment
Please, Sign In to add comment