[求助]在关键字 'and' 附近有语法错误。

az0988 2008-03-21 05:33:21
麻烦高手看看
select cd,spid,ysdm,cmdm,sum(total)as sl from vw_jxchzb where cdlb='sd'group by cd,spid,ysdm,cmdm and rqdate='18'
最后报在关键字 'and' 附近有语法错误。
...全文
160 点赞 收藏 14
写回复
14 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
ojuju10 2008-03-22

select cd,spid,ysdm,cmdm,sum(total)as sl from vw_jxchzb where cdlb='sd' and rqdate='18'
group by cd,spid,ysdm,cmdm
回复
heshengfen123 2008-03-22
select cd,spid,ysdm,cmdm,sum(total)as sl from vw_jxchzb where cdlb='sd'and rqdate='18' group by cd,spid,ysdm,cmdm 
回复
蜜_Lumia 2008-03-22
学习学习
回复
cxmcxm 2008-03-21
位置调一下即可
select cd,spid,ysdm,cmdm,sum(total)as sl 
from vw_jxchzb where cdlb='sd' and rqdate='18' group by cd,spid,ysdm,cmdm
回复
-狙击手- 2008-03-21
select cd,spid,ysdm,cmdm,sum(total)as sl
from vw_jxchzb
where cdlb='sd' and rqdate='18'
group by cd,spid,ysdm,cmdm
回复
where 条件要在group by之前。
回复
az0988 2008-03-21
谢谢大家,已经有查询结果出来,定义的公式有问题,出的数据不是想要的,但是语句是正确的了~谢谢
回复
kinghb 2008-03-21
select cd,spid,ysdm,cmdm,sum(total) as sl from vw_jxchzb where cdlb='sd' and rqdate='18' group by cd,spid,ysdm,cmdm

group by 应该放在过滤条件之后
回复
wzy_love_sly 2008-03-21
select cd,spid,ysdm,cmdm,
sum(total)as sl
from vw_jxchzb
where cdlb='sd' and datename(dd,rqdate)='18'
group by cd,spid,ysdm,cmdm


datename(dd,rqdate) 是日
datename(mm,rqdate) 是月
datename(yy,rqdate) 是年
回复
wzy_love_sly 2008-03-21
select cd,spid,ysdm,cmdm,
sum(total)as sl
from vw_jxchzb
where cdlb='sd' and rqdate='18'
group by cd,spid,ysdm,cmdm


回复
az0988 2008-03-21
谢谢。。语句是过了。。但是

服务器: 消息 241,级别 16,状态 1,行 1
从字符串转换为 datetime 时发生语法错误。
回复
liangCK 2008-03-21
where就where
group就group

select cd,spid,ysdm,cmdm,sum(total)as sl
from vw_jxchzb
where cdlb='sd' and rqdate='18'
group by cd,spid,ysdm,cmdm
回复
山之魂2 2008-03-21
select cd,spid,ysdm,cmdm,sum(total)as sl from vw_jxchzb where cdlb='sd' and rqdate='18'  group by cd,spid,ysdm,cmdm 
回复
相关推荐
发帖
MS-SQL Server
创建于2007-09-28

3.3w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
帖子事件
创建了帖子
2008-03-21 05:33
社区公告
暂无公告