新手……问关于SQL模糊查询语句
时间:2011-12-06
来源:互联网
想查询出这张表里面1月2月的数据,数据是xxxx年x月x日!!!
求模糊查询出这张表1月2月的所有数据!谢谢
作者: wympeter 发布时间: 2011-12-06
作者: p2227 发布时间: 2011-12-06
create table tb (id int,shijian nvarchar(10)) insert into tb select 1,'2011年1月2日' union all select 2,'2010年1月2日' union all select 3,'2010年1月3日' select * From tb where shijian like '____年1月2日'
作者: koumingjie 发布时间: 2011-12-06
select * from 表名 where 字段名 like '%月’
作者: sxssg 发布时间: 2011-12-06
select * from 表名 where 日期字段 between '2011-01-01' and '2011-02-29'
作者: pengxuan 发布时间: 2011-12-06
你的意思是说你的日期用了字符串来存?
对的!上面的好像都不对!
作者: wympeter 发布时间: 2011-12-06
select count(*) from 表名 where 字段名 like '%年1月%' or 字段名 like '%年2月%'
作者: qianjin036a 发布时间: 2011-12-06
create table tb(dt nvarchar(12)) insert into tb select '2010年5月9日' insert into tb select '2010年12月11日' insert into tb select '2010年1月1日' --1 insert into tb select '2011年2月15日' --2 insert into tb select '2012年5月22日' insert into tb select '2011年11月14日' go select count(*) from tb where dt like '%年1月%' or dt like '%年2月%' /* ----------- 2 (1 行受影响) */ go drop table tb
作者: qianjin036a 发布时间: 2011-12-06
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28