为了账号安全,请及时绑定邮箱和手机立即绑定

使查询更简单

使查询更简单

PHP
慕盖茨4494581 2021-04-06 17:18:15
我有此查询将连接到我的数据库。我遇到了加载所需数据的速度太慢的问题。SELECTIFNULL((SELECT SUM(c.due_to_office) AS dt_amount FROM sales_entry_summary a, sales_products b, sales_entry c WHERE a.ses_id = c.ses_id AND a.sales_date = '2019-01-01' AND a.`status` = 'AUDITED' AND a.product_id = b.product_id AND b.so_category = 'DT'),0) AS dt_amounts,IFNULL((SELECT SUM(c.due_to_office) AS rt_amount FROM sales_entry_summary a, sales_products b, sales_entry c WHERE a.ses_id = c.ses_id AND a.sales_date = '2019-01-01' AND a.`status` = 'AUDITED' AND a.product_id = b.product_id AND b.so_category = 'RT'),0) AS rt_amounts,IFNULL((SELECT SUM(c.due_to_office) AS it_amount FROM sales_entry_summary a, sales_products b, sales_entry c WHERE a.ses_id = c.ses_id AND a.sales_date = '2019-01-01' AND a.`status` = 'AUDITED' AND a.product_id = b.product_id AND b.so_category = 'IT'),0) AS it_amounts,IFNULL((SELECT SUM(c.due_to_office) AS lr_amount FROM sales_entry_summary a, sales_products b, sales_entry c WHERE a.ses_id = c.ses_id AND a.sales_date = '2019-01-01' AND a.`status` = 'AUDITED' AND a.product_id = b.product_id AND b.so_category = 'LR'),0) AS lr_amounts,IFNULL((SELECT SUM(c.due_to_office) AS ir_amount FROM sales_entry_summary a, sales_products b, sales_entry c WHERE a.ses_id = c.ses_id AND a.sales_date = '2019-01-01' AND a.`status` = 'AUDITED' AND a.product_id = b.product_id AND b.so_category = 'IR'),0) AS ir_amounts,IFNULL((SELECT SUM(c.due_to_office) AS v_amount FROM sales_entry_summary a, sales_products b, sales_entry c WHERE a.ses_id = c.ses_id AND a.sales_date = '2019-01-01' AND a.`status` = 'AUDITED' AND a.product_id = b.product_id AND b.so_category = 'V'),0) AS v_amounts;
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 166 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信