我搜索了一些非常有帮助的例子,但在创建我的查询时却遇到了查询的一部分问题......
很抱歉无法提供完整的表格结构。这是一个有效的查询...
select i.spl_instr_code_1 LW,
SUM((d.units_ordered/i.std_sub_pack_qty) - (d.units_rcvd/i.std_sub_pack_qty)) as "Booked"
From wmdbadmin.item_master i, wmdbadmin.cust_po_appt c, wmdbadmin.po_hdr h,
wmdbadmin.po_dtl d, wmdbadmin.appt_sched a, wmdbadmin.vendor_master v,
wmdbadmin.sys_code s
where h.ref_field_2 = 'N' and
c.appt_nbr = a.appt_nbr (+) and c.po_nbr = h.po_nbr and
h.po_nbr = d.po_nbr and i.sku_id = d.sku_id and
h.vendor_master_id = v.vendor_master_id and s.code_id = a.stat_code and
s.rec_type = 'S' and s.code_type = '628' and s.code_desc<>'Scheduled' and
a.stat_code <= '90' and ((to_char(a.sched_date_time,'YYYYMMDD')>= '20150401'
and to_char(a.sched_date_time, 'YYYYMMDD')<='20150401'))
group by i.spl_instr_code_1
order by i.spl_instr_code_1 asc
我试图通过改变......来改变上述情况。
SUM((d.units_ordered/i.std_sub_pack_qty) - (d.units_rcvd/i.std_sub_pack_qty)) as "Booked"
为...
SUM( case when s.code_desc<>'Checked In' then (d.units_ordered/i.std_sub_pack_qty) else (d.units_rcvd/i.std_sub_pack_qty) end ) as “Booked”
但我收到以下错误,我不确定错误意味着什么,也无法弄清楚如何纠正错误...
#Source:OraOLEDB编号:-2147467259描述:ORA-00972:标识符太长SQL状态:本机错误:972
#Failed打开记录集[hr = 2147500037(0x80004005)]
#Source:ADODB.Recordset Number:3704说明:关闭对象时不允许操作。 SQL:选择i.spl_instr_code_1 LW,SUM(s.code_desc&lt;&gt;'签入'然后(d.units_ordered / i.std_sub_pack_qty)其他(d.units_rcvd / i.std_sub_pack_qty)结束时的情况)作为“预订”来自wmdbadmin .item_master i,wmdbadmin.cust_po_appt c,wmdbadmin.po_hdr h,wmdbadmin.po_dtl d,wmdbadmin.appt_sched a,wmdbadmin.vendor_master v,wmdbadmin.sys_code s其中h.ref_field_2 ='N'和c.appt_nbr = a.appt_nbr( +)和c.po_nbr = h.po_nbr和h.po_nbr = d.po_nbr和i.sku_id = d.sku_id和h.vendor_master_id = v.vendor_master_id和s.code_id = a.stat_code和s.rec_type ='S'和s.code_type ='628'和s.code_desc&lt;&gt;'预定'和a.stat_code&lt; ='90'和((to_char(a.sched_date_time,'YYYYMMDD')&gt; ='20150331'和to_char( a.sched_date_time,'YYYYMMDD')&lt; ='20150331'))按i.spl_instr_code_1 asc的顺序i.spl_instr_code_1排序
#Source:SQLBuilder.clsSQLBuilder Number:25004描述:从数据库返回的已关闭记录集对象。
在Business Object上调用GetRecords时失败。在线:385
调用RefreshDataGrid时失败。