<br/>ON CASE expression<br/> CASE expr_1:<br/> statements_1<br/> break<br/> CASE expr_2:<br/> statements_2<br/> break<br/> CASE expr_3:<br/> statements_3<br/> break<br/> DEFAULT: | optional<br/> statements<br/> ENDCASE<br/>
最近根据用户需要,开发一个通过csv批量上传更新Sales Order Line上的Planned Delivery Date的一个Session,同时需要打印报表给出本次上传的所有订单(行)的更新状态。上传的文件可以是文本文件.txt后缀也可以直接.csv,只要是用,分割就可以。上传的文件一共有4列如下,日期格式为MM-DD-YYYY。
第一篇地址[URL=http://www.cuiwenyuan.com/baan/exchange/how-to-use-baan-exchange-export-data.html]《How to use Baan Exchange export Data?如何使用Baan Exchange导出数据?》[/URL],你将能在2008年8月1日看到完整的图文版内容(我食言了!)。
select tdsls401.orno, tdsls401.pono, tdsls401.sqnb from tdsls401, | Sales Order Lines whinh430, | Shipment whinh431 | Shipment Lines where whinh431.worn = tdsls401.orno and whinh431.wpon = tdsls401.pono and whinh431.wseq = tdsls401.sqnb and whinh430.pcsp = tcyesno.yes and whinh431.shpm = whinh430.shpm and (whinh431.worg = whinh.oorg.sales or whinh431.worg = whinh.oorg.purchase) order by tdsls401.orno,tdsls401.pono
反选的时候,用Not Exists
select tdsls401.orno, tdsls401.pono, tdsls401.sqnb from tdsls401 | Sales Order Lines where not exists (select * from whinh430, | Shipment whinh431 | Shipment Lines where whinh431.worn = tdsls401.orno and whinh431.wpon = tdsls401.pono and whinh431.wseq = tdsls401.sqnb and whinh430.pcsp = tcyesno.yes and whinh431.shpm = whinh430.shpm and (whinh431.worg = whinh.oorg.sales or whinh431.worg = whinh.oorg.purchase)) order by tdsls401.orno,tdsls401.pono
其实第一种正常查询中,查询多个表中关联出现的结果集也可以用Exists:
select tdsls401.orno, tdsls401.pono, tdsls401.sqnb from tdsls401 | Sales Order Lines where exists (select * from whinh430, | Shipment whinh431 | Shipment Lines where whinh431.worn = tdsls401.orno and whinh431.wpon = tdsls401.pono and whinh431.wseq = tdsls401.sqnb and whinh430.pcsp = tcyesno.yes and whinh431.shpm = whinh430.shpm and (whinh431.worg = whinh.oorg.sales or whinh431.worg = whinh.oorg.purchase)) order by tdsls401.orno,tdsls401.pono