夜大哥的好像...select * from tablename where month(m_birthday)=month(getdate()) and day(m_birthday)=day(m_birthday)
m_birthday字段的格式是什么样子的?
上面的 where month(m_birthday)=month(getdate()) and day(m_birthday)=day(m_birthday)好象是 where month(m_birthday)=month(getdate()) and day(m_birthday)=day(getdate())
select * from 表 where datediff(dd,dateadd(yy,datediff(yy,生日字段,{fn now()}),生日字段),{fn now()})=0
select * from 表 where datediff(dd,dateadd(yy,datediff(yy,生日字段,{fn now()}),生日字段),{fn now()})=0
上面的 where month(m_birthday)=month(getdate()) and day(m_birthday)=day(m_birthday)好象是 where month(m_birthday)=month(getdate()) and day(m_birthday)=day(getdate()) ---------------------- *_* 果然....3Q
select * from tablename where datediff(day,getdat(),m_birthday)=0用神的办法就可以 where month(m_birthday)=month(getdate()) and day(m_birthday)=day(getdate()) 这咱方法有点太... ^^
select * from table where datediff(day, getdate(), replace(convert(varchar(10), m_birthday, 121), cast(year(m_birthday) as varchar), cast(year(getdate()), varchar)) = 0
select * from table where datediff(day, getdate(), replace(convert(varchar(10), m_birthday, 121), cast(year(m_birthday) as varchar), cast(year(getdate()) as varchar)) = 0
select * from table where datediff(day, getdate(), replace(convert(varchar(10), m_birthday, 121), cast(year(m_birthday) as varchar), cast(year(getdate()), varchar))) = 0
我CALL,这么麻烦吗?我一直用 "select * from table where m_birthday='"&now()&"'"
"select * from table where m_birthday='"&date()&"'"
楼主,你用得now() 是其他语言中的函数 在SQL中的当前日期函数应该是 getdate()
sxycgxj(云中客) ( ) 信誉:100 select * from tablename where datediff(day,getdat(),m_birthday)=0用神的办法就可以 where month(m_birthday)=month(getdate()) and day(m_birthday)=day(getdate()) 这咱方法有点太... ^^ ------------------------------------------- where datediff(day,getdat(),m_birthday)=0這個不是找生日的吧 @_@ 生日不考慮年,只考慮月和日的吧~~~
上面写 where m_birthday='"&date()&"'" 或 '"&now()&"'" 或where datediff(day,getdat(),m_birthday)=0 的朋友,你们一辈子只过一次生日么?
where month(m_birthday)=month(getdate()) and day(m_birthday)=day(m_birthday)
where month(m_birthday)=month(getdate()) and day(m_birthday)=day(m_birthday)好象是
where month(m_birthday)=month(getdate()) and day(m_birthday)=day(getdate())
where
datediff(dd,dateadd(yy,datediff(yy,生日字段,{fn now()}),生日字段),{fn now()})=0
where
datediff(dd,dateadd(yy,datediff(yy,生日字段,{fn now()}),生日字段),{fn now()})=0
where month(m_birthday)=month(getdate()) and day(m_birthday)=day(m_birthday)好象是
where month(m_birthday)=month(getdate()) and day(m_birthday)=day(getdate())
----------------------
*_*
果然....3Q
where datediff(day,getdat(),m_birthday)=0用神的办法就可以
where month(m_birthday)=month(getdate()) and day(m_birthday)=day(getdate())
这咱方法有点太...
^^
where datediff(day, getdate(), replace(convert(varchar(10), m_birthday, 121), cast(year(m_birthday) as varchar), cast(year(getdate()), varchar)) = 0
where datediff(day, getdate(), replace(convert(varchar(10), m_birthday, 121), cast(year(m_birthday) as varchar), cast(year(getdate()) as varchar)) = 0
where datediff(day, getdate(),
replace(convert(varchar(10), m_birthday, 121),
cast(year(m_birthday) as varchar),
cast(year(getdate()), varchar))) = 0
"select * from table where m_birthday='"&now()&"'"
在SQL中的当前日期函数应该是 getdate()
select * from tablename
where datediff(day,getdat(),m_birthday)=0用神的办法就可以
where month(m_birthday)=month(getdate()) and day(m_birthday)=day(getdate())
这咱方法有点太...
^^
-------------------------------------------
where datediff(day,getdat(),m_birthday)=0這個不是找生日的吧 @_@
生日不考慮年,只考慮月和日的吧~~~
或where datediff(day,getdat(),m_birthday)=0 的朋友,你们一辈子只过一次生日么?