求助,怎样修改代码使程序取数据快一点
下面是查询代码,怎样修改下面的set filter to 语句查询时才能快一点
或者改那些代码执行时才能快
public l_tj1
select ck_cp_o * 表1
set order to bm_bh
select ck_cp_op * 表2
set order to bm_bh
select ck_cp_o
set relation to bm_bh into ck_cp_op * 表2和表2通过bm_bh相关联
l_tj1 = 'ck_cp_o.ck_date>=ctod(l_ckd1) and ck_cp_o.ck_date<=ctod(l_ckd2)'
if l_ckbh==''
else
l_tj1 = l_tj1+' .AND. alltrim(ck_cp_o.bm_bh)=l_ckbh'
endi
if l_ckfs==''
else
l_tj1 = l_tj1+' .AND. alltrim(ck_cp_o.ck_what)=l_ckfs'
endi
if l_ckbuy==''
else
l_tj1 = l_tj1+' .AND. alltrim(ck_cp_o.dw_buy)=l_ckbuy'
endi
select ck_cp_o
set filter to &l_tj1
select ck_cp_o
set order to bm_bh
goto bottom
skip -5
THISFORM.grdck.RECORDSOURCETYPE = 1
THISFORM. grdck.RECORDSOURCE = "ck_cp_o"
THISFORM.grdck.COLUMNCOUNT = 11
THISFORM.grdck.FONTSIZE = 12
thisform.grdck.readonly = .t.
THISFORM.grdck.COLUMN1.HEADER1.CAPTION = "磅码单号"
THISFORM.grdck.COLUMN1.controlsource = "ck_cp_o.bm_bh"
THISFORM.grdck.COLUMN1.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN1.text1.FONTSIZE = 12
THISFORM.grdck.COLUMN1.WIDTH = 88
THISFORM.grdck.COLUMN1.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN2.HEADER1.CAPTION = "提货单位"
THISFORM.grdck.COLUMN2.controlsource = "ck_cp_o.dw_buy"
THISFORM.grdck.COLUMN2.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN2.WIDTH = 280
THISFORM.grdck.COLUMN2.text1.FONTSIZE = 12
THISFORM.grdck.COLUMN2.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN3.HEADER1.CAPTION = "提货日期"
THISFORM.grdck.COLUMN3.controlsource = "ck_cp_o.ck_date"
THISFORM.grdck.COLUMN3.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN3.WIDTH = 90
THISFORM.grdck.COLUMN3.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN3.text1.FONTSIZE = 12
THISFORM.grdck.COLUMN4.HEADER1.CAPTION = "出库方式"
THISFORM.grdck.COLUMN4.controlsource = "ck_cp_o.ck_what"
THISFORM.grdck.COLUMN4.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN4.WIDTH = 80
THISFORM.grdck.COLUMN4.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN4.text1.FONTSIZE = 12
THISFORM.grdck.COLUMN5.HEADER1.CAPTION = "生产单位"
THISFORM.grdck.COLUMN5.controlsource = "ck_cp_o.sc_dw"
THISFORM.grdck.COLUMN5.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN5.WIDTH = 80
THISFORM.grdck.COLUMN5.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN5.text1.FONTSIZE = 12
THISFORM.grdck.COLUMN6.HEADER1.CAPTION = "重量单位"
THISFORM.grdck.COLUMN6.controlsource = "ck_cp_o.dw"
THISFORM.grdck.COLUMN6.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN6.WIDTH = 70
THISFORM.grdck.COLUMN6.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN6.text1.FONTSIZE = 12
THISFORM.grdck.COLUMN7.HEADER1.CAPTION = "标(称)重"
THISFORM.grdck.COLUMN7.controlsource = "ck_cp_o.bc"
THISFORM.grdck.COLUMN7.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN7.WIDTH = 70
THISFORM.grdck.COLUMN7.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN7.text1.FONTSIZE = 12
THISFORM.grdck.COLUMN8.HEADER1.CAPTION = "跟随单位"
THISFORM.grdck.COLUMN8.controlsource = "ck_cp_o.wei_dw"
THISFORM.grdck.COLUMN8.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN8.WIDTH = 120
THISFORM.grdck.COLUMN8.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN8.text1.FONTSIZE = 12
THISFORM.grdck.COLUMN9.HEADER1.CAPTION = "是否结算"
THISFORM.grdck.COLUMN9.controlsource = "ck_cp_o.sfjs"
THISFORM.grdck.COLUMN9.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN9.WIDTH = 72
THISFORM.grdck.COLUMN9.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN9.text1.FONTSIZE = 12
THISFORM.grdck.COLUMN10.HEADER1.CAPTION = "合同号"
THISFORM.grdck.COLUMN10.controlsource = "ck_cp_o.ha_hth"
THISFORM.grdck.COLUMN10.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN10.WIDTH = 100
THISFORM.grdck.COLUMN10.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN10.text1.FONTSIZE = 12
THISFORM.grdck.COLUMN11.HEADER1.CAPTION = "备注"
THISFORM.grdck.COLUMN11.controlsource = "ck_cp_o.bz"
THISFORM.grdck.COLUMN11.HEADER1.FONTSIZE = 12
THISFORM.grdck.COLUMN11.WIDTH = 180
THISFORM.grdck.COLUMN11.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck.COLUMN11.text1.FONTSIZE = 12
select ck_cp_op
THISFORM.grdck_mx.RECORDSOURCETYPE = 1
THISFORM. grdck_mx.RECORDSOURCE = "ck_cp_op"
THISFORM.grdck_mx.COLUMNCOUNT = 6
THISFORM.grdck_mx.FONTSIZE = 12
thisform.grdck_mx.readonly = .t.
THISFORM.grdck_mx.COLUMN1.HEADER1.CAPTION = " 批 号"
THISFORM.grdck_mx.COLUMN1.controlsource = "ck_cp_op.ph"
THISFORM.grdck_mx.COLUMN1.HEADER1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN1.text1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN1.WIDTH = 100
THISFORM.grdck_mx.COLUMN1.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck_mx.COLUMN2.HEADER1.CAPTION = " 色 号"
THISFORM.grdck_mx.COLUMN2.controlsource = "ck_cp_op.sh"
THISFORM.grdck_mx.COLUMN2.HEADER1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN2.WIDTH = 108
THISFORM.grdck_mx.COLUMN2.text1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN2.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck_mx.COLUMN3.HEADER1.CAPTION = " 支 数 品 质"
THISFORM.grdck_mx.COLUMN3.controlsource = "ck_cp_op.ck_wp"
THISFORM.grdck_mx.COLUMN3.HEADER1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN3.WIDTH = 250
THISFORM.grdck_mx.COLUMN3.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck_mx.COLUMN3.text1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN4.HEADER1.CAPTION = " 货 位"
THISFORM.grdck_mx.COLUMN4.controlsource = "ck_cp_op.hw"
THISFORM.grdck_mx.COLUMN4.HEADER1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN4.WIDTH = 100
THISFORM.grdck_mx.COLUMN4.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck_mx.COLUMN4.text1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN5.HEADER1.CAPTION = "包号"
THISFORM.grdck_mx.COLUMN5.controlsource = "ck_cp_op.baoh"
THISFORM.grdck_mx.COLUMN5.HEADER1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN5.WIDTH = 50
THISFORM.grdck_mx.COLUMN5.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck_mx.COLUMN5.text1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN6.HEADER1.CAPTION = " 标 重"
THISFORM.grdck_mx.COLUMN6.controlsource = "ck_cp_op.bao_num"
THISFORM.grdck_mx.COLUMN6.HEADER1.FONTSIZE = 12
THISFORM.grdck_mx.COLUMN6.WIDTH = 100
THISFORM.grdck_mx.COLUMN6.HEADER1.FORECOLOR = RGB(0,0,255)
THISFORM.grdck_mx.COLUMN6.text1.FONTSIZE = 12