求问阿!我下面的句子有什么不对??

red_wolf 2004-08-20 11:49:32
select Y_type,SUM(Y_RMB) as a from admin_yewu where Y_time<2001-8-8 and Y_time>2004-6-8 group by Y_type

数据库中Y_time字段是datetime类型

如果不对!要怎么写啊??
急急急!
...全文
167 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
red_wolf 2004-08-20
  • 打赏
  • 举报
回复
为什么没有人理我啊!
lzymagi 2004-08-20
  • 打赏
  • 举报
回复
你可以用>'20040608'
yingshis 2004-08-20
  • 打赏
  • 举报
回复
注意日期用‘’括起来。
select Y_type,SUM(Y_RMB) as a from admin_yewu where Y_time between '2001-8-8' and '2004-6-8' group by Y_type
pzr 2004-08-20
  • 打赏
  • 举报
回复
Select Y_type,SUM(Y_RMB) as a
From admin_yewu
Where Y_time<'2001-8-8' and Y_time>'2004-6-8'
Group by Y_type
日期用单引号括起来
start1127 2004-08-20
  • 打赏
  • 举报
回复
日期用单引号括起来
xiyang2170 2004-08-20
  • 打赏
  • 举报
回复
Select Y_type,SUM(Y_RMB) as a
From admin_yewu
Where Y_time<'2001-8-8' and Y_time>'2004-6-8'
Group by Y_type
loverpyh 2004-08-20
  • 打赏
  • 举报
回复
select Y_type,SUM(Y_RMB) as a from admin_yewu where convert(char(10),Y_time,120)<'2001-08-08' and convert(char(10),Y_time,120)>'2004-06-08' group by Y_type
lb_panda 2004-08-20
  • 打赏
  • 举报
回复
select Y_type,SUM(Y_RMB) as a from admin_yewu where Y_time between '2001-8-8' and '2004-6-8' group by Y_type
zjcxc 元老 2004-08-20
  • 打赏
  • 举报
回复

--日期要用'括起来

select Y_type,SUM(Y_RMB) as a from admin_yewu where Y_time<'2001-8-8' and Y_time>'2004-6-8' group by Y_type

34,873

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧