语句如下,此语句在SQL2012下没有报错,可以正常发布,查询报表。
select distinct
max(t0.fbilltraceid) as fbilltraceid -------------追踪信息内码 (最近一笔单据追踪信息内码)
,a0.fnumberserial,a0.fnumber,a0.fserialid -------------序列号,物料编号,序列号主档ID
from T_BD_SERIALBILLTRACE t0 ---------------序列号主档单据追踪信息表
inner join
(-------查序列号主档ID
select t0.fserialid, ----------序列号ID
t0.fnumber as fnumberserial,t1.fnumber ----------------序列号,物料编号
from T_BD_SERIALMASTER t0 -------------序列号主档主表
inner join T_BD_MATERIAL t1 on t0.fmaterialid =t1.fmaterialid ----关联物料表,防止有相同序列号物料。
)a0
on t0.fserialid=a0.fserialid -------序列号ID相同
where t0.fbilldate <=to_date('@fdate@','yyyy-mm-dd') ------------序列号单据条件日期范围
and t0.fdeststockorgid=_CurrentOrgUnitId_
group by a0.fnumberserial,a0.fnumber,a0.fserialid -----------分组查询最大序列号追踪ID
截图如下:
报错是什么意思。有人知道吗?谢谢。
推荐阅读