如何在同一个SQL语句里写呢?
解决方案 »
- MS SQL Server2000个人版去哪里下载阿?急需!
- 求一条selectl语句
- 问一个关于SQL Server 2005登录的问题[Management Studio]
- 请教MS SQL Server 2000企业版的安装问题!
- 数据库修复页面时报语法错误,麻烦高手帮忙
- 含有select top “num”(num是参数)的存储过程怎么写啊?
- 求个带条件的分页 查询 SQL语句
- 看看合理吗
- union的时候怎么用order by?
- 从oralce的procedure中返回的varchar2最大为多少?
- 怎样用SQL语名返回金额的大写??急!!!
- 大家帮我看一下以下一段存储过程出了什么问题?
Server: Msg 8120, Level 16, State 1, Line 1
Column 'tab.dishname' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Server: Msg 8120, Level 16, State 1, Line 1
Column 'tab.stylenum' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Server: Msg 8120, Level 16, State 1, Line 1
Column 'tab.quant' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Server: Msg 8120, Level 16, State 1, Line 1
Column 'dish.dedute' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
( ----你的查询语句
select tab.* ,dish.dedute from
(select dishnum,dishname,stylenum,'quant'=count(*)
from saledetail
where (saleid in(select saleid
from salemaster
where (saledate>='20021116000000') and (saledate<'20021117000000')and (posnum='001')))and (spid='001') Group by dishnum,dishname,stylenum)as tab
left outer join dish on (dish.number=tab.dishnum)and (dish.spec=tab.stylenum)) temptable group by XXXX
select tab.* ,dish.dedute from
(select dishnum,dishname,stylenum,'quant'=count(*)
from saledetail
where (saleid in(select saleid
from salemaster
where (saledate>='20021116000000') and (saledate<'20021117000000')and (posnum='001')))and (spid='001') Group by dishnum,dishname,stylenum)as tab
left outer join dish on (dish.number=tab.dishnum)and (dish.spec=tab.stylenum)
)A group by 你的分组列