打印

[求助] SQL中怎么查询出今天过生日的人

SQL中怎么查询出今天过生日的人

在SQL的数据库表中,怎么实现查询出今天过生日的人的记录,具体的SQL语句怎么写!

谢谢啊!!
http://blog.sina.com.cn/juhuaYE



The only limit to our realization of tomorrow will be our doubts of today!!!

TOP

select * from table
where birthday="2007-05-13"

TOP

呵呵!你还真的会写哈!
错得太离谱了嘛!


不过还是谢谢你哈!
http://blog.sina.com.cn/juhuaYE



The only limit to our realization of tomorrow will be our doubts of today!!!

TOP

引用:
原帖由 ct_hunter 于 2007-5-14 22:12 发表
呵呵!你还真的会写哈!
错得太离谱了嘛!


不过还是谢谢你哈!
人家是来帮助你的。。。

TOP

我知道啊!
我还是很感谢她的!
http://blog.sina.com.cn/juhuaYE



The only limit to our realization of tomorrow will be our doubts of today!!!

TOP

真逗,,你们

TOP

SQL SERVER中可以用函数: convert(char(8),getdate(),112)

TOP

引用:
原帖由 ct_hunter 于 2007-5-14 22:12 发表
呵呵!你还真的会写哈!
错得太离谱了嘛!


不过还是谢谢你哈!
来个正确的让大家瞧瞧
偶也是数据库新手

TOP

我也是..
专业杀猪,业余杀人。白日喜困,雨夜来神。

TOP

先取得今天的月份和日期付给一个变量,比如($today = "-5-24"),
以mysql为例,查询可以这样写
select * from tab_name where col_name like (".$today.");

TOP

mysql下的另一种写法:
select * from tab_name where col_name like (select concat('%',(select date_format(NOW(),'-%m-%d')),'%'));

[ 本帖最后由 everest 于 2007-5-25 08:26 编辑 ]

TOP

都是高手!看不懂!

TOP

引用:
原帖由 everest 于 2007-5-25 08:25 发表
mysql下的另一种写法:
select * from tab_name where col_name like (select concat('%',(select date_format(NOW(),'-%m-%d')),'%'));
谢谢哈!
http://blog.sina.com.cn/juhuaYE



The only limit to our realization of tomorrow will be our doubts of today!!!

TOP

谢谢大家哈!
http://blog.sina.com.cn/juhuaYE



The only limit to our realization of tomorrow will be our doubts of today!!!

TOP

引用:
原帖由 everest 于 2007-5-25 08:25 发表
mysql下的另一种写法:
select * from tab_name where col_name like (select concat('%',(select date_format(NOW(),'-%m-%d')),'%'));
学习了,谢谢!

TOP

能看懂了

TOP

-%m-%d'

这个是不是获取当前月和天的方法?

TOP

向各位学习了!

TOP

怎么可能?

除非先有个数据库,有数据在内。then:
select × from xxx where bitthday = getdate()

TOP

MS SQL咋写呢。。
select name from table where right(convert(varchar(8),birthday,112),4))=right(convert(varchar(8),getdate(),112),4))

[ 本帖最后由 tianjianjun 于 2007-10-24 08:33 编辑 ]

TOP

本功能由奇虎搜索实现

相关主题

标题 作者 最后发表
[站外] 查询指定日期段内过生日的人员.sql   [转帖] 阿饼 2008-10-23
[站外] SQL语句查询生日以及今日生日!   [转帖] bs_zbj 2008-11-13
[站外] 查询某段时间内过生日的员工名单的SQL语句   [转帖] 边走边唱 2008-11-26
点击阅读更多关于的相关帖子  更多相关主题