mysql 内存溢出_一条sql 写的mysql数据库内存溢出

select

a.tmh_program_date,a.tmh_tpcode,a.tmh_equitment_code,a.tmh_time

atime,a.tmh_hour a,c.tmh_time ctime,c.tmh_hour c,p1.tmh_time

p1time,p1.tmh_hour p1,p0.tmh_time p0time,p0.tmh_hour p0,

(c.tmh_hour-a.tmh_hour) ac,(p1min.tmh_hour-a.tmh_hour)

p1mina,case when p0max.tmh_hour<>0

then p0max.tmh_hour else null end p0max,p1min.tmh_hour

p1min,(c.tmh_hour-p0max.tmh_hour) cp0max,p1.tmh_group

p1g,p0.tmh_group p0g

from

(select

tmh_program_date,tmh_tpcode,tmh_equitment_code,tmh_time,tmh_state,tmh_group,tmh_cause_code,tmh_hour

from tg_machine_halt where tmh_state='A') a

left join

(select

tmh_program_date,tmh_tpcode,tmh_equitment_code,tmh_time,tmh_state,tmh_group,tmh_cause_code,tmh_hour

from tg_machine_halt where tmh_state='C') c

on a.tmh_program_date = c.tmh_program_date and

a.tmh_equitment_code = c.tmh_equitment_code and a.tmh_tpcode =

c.tmh_tpcode

left join

(select

tmh_program_date,tmh_tpcode,tmh_equitment_code,tmh_time,tmh_state,tmh_group,tmh_cause_code,tmh_hour

from tg_machine_halt where tmh_state='1') p1

on a.tmh_program_date = p1.tmh_program_date and

a.tmh_equitment_code = p1.tmh_equitment_code and a.tmh_tpcode =

p1.tmh_tpcode

left join

(select

tmh_program_date,tmh_tpcode,tmh_equitment_code,tmh_time,tmh_state,tmh_group,tmh_cause_code,tmh_hour

from tg_machine_halt where tmh_state='0') p0

on a.tmh_program_date = p0.tmh_program_date and

a.tmh_equitment_code = p0.tmh_equitment_code and a.tmh_tpcode =

p0.tmh_tpcode and p0.tmh_group =

p1.tmh_group

left join

(select

tmh_program_date,tmh_tpcode,tmh_equitment_code,tmh_time,tmh_state,tmh_group,tmh_cause_code,tmh_hour

from tg_machine_halt where tmh_state='1' and tmh_group ='1')

p1min

on a.tmh_program_date = p1min.tmh_program_date and

a.tmh_equitment_code = p1min.tmh_equitment_code and a.tmh_tpcode =

p1min.tmh_tpcode

left join

(select

tmh_program_date,tmh_tpcode,tmh_equitment_code,tmh_time,max(tmh_group)

tmh_group,tmh_cause_code,tmh_hour from tg_machine_halt where

tmh_state='0' group By

tmh_program_date,tmh_tpcode,tmh_equitment_code) p0max

on a.tmh_program_date = p0max.tmh_program_date and

a.tmh_equitment_code = p0max.tmh_equitment_code and a.tmh_tpcode =

p0max.tmh_tpcode ;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值