select count(id) as lei,sum(productnum)as num,max(is_validate) as is_validate,
max(add_date) as add_date,dingdan,warehouse_id,warehouse_in,Max(isPrint) as Isprint,
ROW_NUMBER() OVER ( Order by add_date desc ) AS RowNumber
From
WareHouse_change
where
warehouse_in=1 and zhuangtai=1 and ordertype=0
group by dingdan,warehouse_id,warehouse_in
帮你查询分析器中测试了: The command(s) completed successfully.
没有发现什么问题呀
试试
where
zhuangtai=1 and ordertype=0
group by dingdan,warehouse_id,warehouse_in
having warehouse_in=1
表结构 发上来看看!
ROW_NUMBER() OVER ( Order by add_date desc ) AS RowNumber
窗口函数中add_date 没有包含在聚合函数或 GROUP BY 子句中