handa11 发表于 2007-05-11 15:51

求救呀 帮帮我呀

selectnvl(sum(b.EdrPrm),0) into cs_edr_front from motor_srv@oncpicbnkt:t_edr a, motor_srv@oncpicbnkt:T_EDRDTL b
where a.edrno=b.edrno   anda.p_no=cs_p_noand a.EdrStatus in ('2','3')
and a.md_num<cs_md_num
----
t_edr 的索引是
_t_edr             ccx99   uniqueNo       edrno
                                             fgs

i_t_edr2            ccx99   dupls   No       plc_no
                                             edr_no
                                             fgs

i_t_edr3            ccx99   dupls   No       p_no
                                             fgs

i_t_edr4            ccx99   dupls   No       edr_no
                                             plc_no
                                             fgs
i_t_edr5            ccx99   dupls   No       plc_no
                                             edrno
                                             fgs
t_edrdtl 的索引是
u_t_edrdtl          ccx99   uniqueNo       edrno
                                             edrtype
                                             fgs
请问 这个sql 如果换一种什么方法写可以快点
或者必须加索引的话 怎么加?

yxdth2006 发表于 2007-05-23 13:28

informix中是不可以select * into tablename into tablename 中吧

syitssa 发表于 2007-06-27 16:03

语法错了
如果是插入到临时表 是 select ... into temp ...
不过看楼上是往实表里面插是把
insert into table a
select .... from table b
页: [1]
查看完整版本: 求救呀 帮帮我呀