请帮忙检查一下SQL语句,谢谢!急啊!!!
语句如下selectmember_id,count(oid)astotel_order,sum(order_number*order_times)astotel_numb...
语句如下
select member_id,count(oid) as totel_order,sum(order_number * order_times) as totel_number from [order] where convert(varchar(10),order_time,120) <= '2007-10-16' and convert(varchar(10),order_time,120) >= '2007-10-10' and (order_circs='已经发货' or order_circs='正在处理中') as a,(select member_id from [order] group by member_id having count(*)>1) as b where a.member_id =b.member_id
需要实现的功能是统计在一段时间内所有老客户(客户ID曾在订单表里出现过)所订有效订单(订单状态Order_circs为“已经发货”或“正在处理中”)的总数和所订商品的总数。但运行时总显示“as附近有语法错误”,请高手帮忙解决一下,不胜感激!!!! 展开
select member_id,count(oid) as totel_order,sum(order_number * order_times) as totel_number from [order] where convert(varchar(10),order_time,120) <= '2007-10-16' and convert(varchar(10),order_time,120) >= '2007-10-10' and (order_circs='已经发货' or order_circs='正在处理中') as a,(select member_id from [order] group by member_id having count(*)>1) as b where a.member_id =b.member_id
需要实现的功能是统计在一段时间内所有老客户(客户ID曾在订单表里出现过)所订有效订单(订单状态Order_circs为“已经发货”或“正在处理中”)的总数和所订商品的总数。但运行时总显示“as附近有语法错误”,请高手帮忙解决一下,不胜感激!!!! 展开
2个回答
展开全部
楼主写得似乎有点混乱
select member_id,count(oid) as totel_order,sum(order_number * order_times) as totel_number from [order] where convert(varchar(10),order_time,120) <= '2007-10-16' and convert(varchar(10),order_time,120) >= '2007-10-10' and (order_circs='已经发货' or order_circs='正在处理中') and member_id in(select member_id from [order] group by member_id having count(*)>1) group by member_id
select member_id,count(oid) as totel_order,sum(order_number * order_times) as totel_number from [order] where convert(varchar(10),order_time,120) <= '2007-10-16' and convert(varchar(10),order_time,120) >= '2007-10-10' and (order_circs='已经发货' or order_circs='正在处理中') and member_id in(select member_id from [order] group by member_id having count(*)>1) group by member_id
展开全部
select member_id,count(oid) as totel_order,sum(order_number * order_times) as totel_number from [order]
where convert(varchar(10),order_time,120) <= '2007-10-16' and convert(varchar(10),order_time,120) >= '2007-10-10' and (order_circs='已经发货' or order_circs='正在处理中') 这样不就可以了?
where convert(varchar(10),order_time,120) <= '2007-10-16' and convert(varchar(10),order_time,120) >= '2007-10-10' and (order_circs='已经发货' or order_circs='正在处理中') 这样不就可以了?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询