首页 新闻 会员 周边 捐助

这个group by 语句怎么老是不对啊?

0
悬赏园豆:100 [待解决问题]



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
douqiumiao的主页 douqiumiao | 初学一级 | 园豆:6
提问于:2011-09-10 10:55
< >
分享
所有回答(5)
0

帮你查询分析器中测试了: The command(s) completed successfully.
没有发现什么问题呀

沧海小小粟 | 园豆:164 (初学一级) | 2011-09-10 15:10
0

试试

where
zhuangtai
=1 and ordertype=0
group by dingdan,warehouse_id,warehouse_in
having warehouse_in=1

dudu | 园豆:29951 (高人七级) | 2011-09-10 15:11
0
改成下面的语句试试看:
select *,ROW_NUMBER() AS RowNumber from
(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
From
WareHouse_change
where
warehouse_in
=1 and zhuangtai=1 and ordertype=0
group by dingdan,warehouse_id,warehouse_in)
Wuya | 园豆:281 (菜鸟二级) | 2011-09-12 17:57
0

表结构 发上来看看!

jingjunfeng | 园豆:873 (小虾三级) | 2011-09-14 18:05
0

ROW_NUMBER() OVER ( Order by add_date desc ) AS RowNumber

窗口函数中add_date 没有包含在聚合函数或 GROUP BY 子句中

JentleWang | 园豆:160 (初学一级) | 2011-10-06 15:43
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册