define view ZDD_CREATE_ORDER as select from zmmr031_1 left outer join zsdt003mc as a on zmmr031_1.vbeln = a.vbeln and (a.zflag = 'B' or a.zflag = 'C' ) left outer join mara as b on zmmr031_1.matnr = b.matnr { key cast( zmmr031_1.vbeln as bstkd ) as bstkd, key zmmr031_1.kunnr, key zmmr031_1.matnr, a.vkorg, a.auart, zmmr031_1.zdate as lfdat, cast( zmmr031_1.erfmg as kwmeng ) as KWMENG, cast(b.meins as vrkme ) as vrkme, cast( '' as mvgr1 ) as MVGR1, cast( '' as mvgr2 ) as MVGR2, 'A' as type }这句sql中,怎么在on条件后面截取zmmr031_1.vbeln的前13位
时间: 2023-07-15 19:14:42 浏览: 283
Define_Grid_Motion.zip_DEFINE_GRID_MOTION_fluent udf_fluent变形_f
5星 · 资源好评率100%
你可以使用 SUBSTRING 函数来截取 zmmr031_1.vbeln 的前 13 位,如下所示:
```
define view ZDD_CREATE_ORDER as
select from zmmr031_1
left outer join zsdt003mc as a
on zmmr031_1.vbeln = a.vbeln and (a.zflag = 'B' or a.zflag = 'C')
left outer join mara as b on zmmr031_1.matnr = b.matnr
{
key cast(SUBSTRING(zmmr031_1.vbeln, 1, 13) as bstkd) as bstkd,
key zmmr031_1.kunnr,
key zmmr031_1.matnr,
a.vkorg,
a.auart,
zmmr031_1.zdate as lfdat,
cast(zmmr031_1.erfmg as kwmeng) as KWMENG,
cast(b.meins as vrkme) as vrkme,
cast('' as mvgr1) as MVGR1,
cast('' as mvgr2) as MVGR2,
'A' as type
}
```
在这里,SUBSTRING 函数的第一个参数是要截取的字符串,第二个参数是开始截取的位置,第三个参数是要截取的长度。在这个例子中,我们将第一个参数设置为 zmmr031_1.vbeln,第二个参数设置为 1,第三个参数设置为 13。这样就可以截取 zmmr031_1.vbeln 的前 13 位了。
阅读全文