[MySql]语句优化问题,求优化
代码
SQL code:
select i.fk_in_no,i.fk_vender_abbrev,i.fk_factory_abbrev,i.fk_part_no,i.fk_spec,i.fk_commodity,i.qty,
i.qty-
ifnull((select sum(o.qty)
from ve_report_outbound_detail o
where i.fk_in_no=o.fk_in_no
and i.fk_part_no=o.fk_vender_part_no
and i.fk_spec=o.fk_vender_spec
and i.fk_commodity=o.fk_vender_commodity
and i.fk_qty_unit_abbrev=o.fk_qty_unit_abbrev),0) as stock_qty,i.fk_qty_unit_abbrev,i.inbound_time
from ve_report_inbound_detail i
having stock_qty>0
视图:ve_report_inbound_detail 和 ve_report_outbound_detail 都只有不到一万的数据
怎么这条语句要执行40多秒
求优化 谢谢大大
这是explain ,那两个show index为空
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived3> ALL 7868
3 DERIVED m ALL Index_InMain_InNo 3253 Using where; Using temporary; Using filesort
3 DERIVED d ref Index_InDetail_InNo Index_InDetail_InNo 92 wms.m.in_no 1 Using where
2 DEPENDENT SUBQUERY <derived5> ALL 11180 Using where
5 DERIVED m ALL Index_InMain_OutNo 3154 Using where; Using temporary; Using filesort
5 DERIVED d ref Index_OutDetail_OutNo Index_OutDetail_OutNo 92 wms.m.out_no 1 Using where
另外有没有其它方法改写这个语
相关问答:
我以前安装了一次,后来卸载了,现在再安装的时候,提示错误:Error 1305.Error reading from file C:DOCUME~1\LOCALS~1\Temp\mysql_server.msi.Verify that the file exists and that you can access it.
可是我找 ......
如题 数据是BLOB类型 怎么才能修改其中的某些值
BLOB中存入的是什么内容?
假设字段memo为blob类型,在该字段的值前面增加字符串'add--'
则操作语句如下:
SQL code:
update tb_blog set memo=concat( ......
在安装Java编译器的Eclipse的时候,对环境变量进行了配置,在安装MySQl的时候也要对环境变量进行配置;那么后面的配置会影响前面的Eclipse的配置吗?
请大家多指教~!谢谢!
不会把,我这都装了的 我系统里 还装了 ......
在三十讲遇到这样一个问题就是运行代码时出现错误 Fatal error: Call to undefined method mysql::fetch_array() in D:\WWW\news\index.php on line 12
,我把mysql::fetch_array() 改成mysql::fetch_row() 又出现F ......
要转成一样的效果,用powerdesigner怎么转?能转吗?
create table publishers (
publisherID int identity,
publisherName varchar (30) NOT NULL,
constraint pk_publishers primary key (publisherID)
)& ......