维护同事编写的程序时遇到的一个问题,求达人解释一下
现在有三个表:
inv.yw_inv_m 入库单主表,inv.yw_inv_d 入库单子表,mdm.dm_material基础数据的物料表。
前台页面数的查询条件是:itemName也就是物料名称。执行的sql语句如下:
select
inv_m.io_type_ as ioType,
inv_m.make_date_ as makeDate,
inv_m.make_psnname_ as makePsnName,
inv_m.bill_status_ as billStatus,
inv_m.audit_psnid_ as auditPsnId,
inv_m.audit_psnname_ as auditPsnName,
inv_m.inv_code_ as invCode,
inv_d.qa_level_ as qaLevel,
inv_d.asme_level_ as asmeLevel,
inv_d.nuclear_level_ as nuclearLevel,
inv_d.tech_spec_ as techSpec,
inv_d.item_id_ as itemId,
inv_d.id_ as id,
inv_d.source_bill_mid_ as sourceBillMid,
inv_d.source_bill_bid_ as sourceBillBid,
inv_d.source_bill_code_ as sourceBillCode,
inv_d.mid_ as mid,
inv_d.item_qty_ as itemQty,
inv_d.ware_id_ as wareId,
inv_d.ware_name_ as wareName,
inv_d.bin_id_ as binId,
inv_d.bin_name_ as binName,
inv_d.loc_id_ as locId,
inv_d.loc_name_ as locName,
inv_d.item_batch_ as itemBatch,
inv_d.item_qty_assist_ as itemQtyOther,
inv_d.note_ as note,
inv_d.sup_id_ as supId,
inv_d.sup_name_ as supName,
inv_d.f_col1_ as fcol1,
inv_d.f_col2_ as fcol2,
inv_d.arrive_date_ as arriveDate,
inv_d.order_code_ as orderCode,
inv_d.buy_psnid_ as buyPsnid,
inv_d.buy_psnname_ as buyPsnname,
material.item_code_ as itemCode,
material.item_name_ as itemName,
material.item_spec_ as itemSpec,
material.item_model_ as itemModel,
material.assist_unit_code_ as unitCode,
material.assist_unit_name_ as unitName,
material.unit_name_ as assistName,
material.change_rate_ as assistRate,
material.item_texture_ || ' ' || material.item_model_ as textureAndModel,
material.item_spec_ ||' '||material.thickness_series_rank_ ||' '||material.nose_preparation_form_ as newSpec,
inv_d.f_col1_ ||' '|| inv_d.tech_spec_ ||' '|| inv_d.nuclear_level_ ||' '|| inv_d.asme_level_ ||' '|| inv_d.qa_level_ ||' '|| material.material_description_ as itemDescription,
material.item_standard_ as itemGb,
material.item_texture_ as itemTexture,
material.nose_preparation_form_ as nosePreparationForm,
material.thickness_series_rank_ as thicknessSeriesRank,
material.material_description_ as materialDescription
from inv.yw_inv_m inv_m,
inv.yw_inv_d inv_d,
mdm.dm_material material
where 1=1
and io_flag_='I'
and inv_m.id_ = inv_d.mid_
and inv_d.item_id_ = material.id_
and exists(select 1 from inv.yw_inv_d inv_d , mdm.dm_material material where inv_m.id_ = inv_d.mid_ and inv_d.item_id_ = material.id_ and ((material.item_name_) like ('%碳钢%') or
&n