现在() [英] Now()
问题描述
我在子表中有一些sql,它在表中找到日期,但仅当
日期小于今天
WHERE [MonthYear]<现在()
我希望它能做到这一点但不包括当前月份。
例如,dd中的日期列表/ mm / yy格式
1/01/05
01/02/05
等
等
01/11/05
01/12/05
01/01/06
01/02 / 06
如果我今天(11/01/06)01/01/06运行这个结果包含在结果中
,因为它比今天少。
但我不想包括当前月份。
任何想法。
鲍勃
Hi,
I have some sql in a sub that finds dates in a table but only if the
date is less than today
WHERE [MonthYear] < Now()
I want it to do that but to not include the current month.
For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06
If I run this today (11/01/06) 01/01/06 is included in the result
because it is less than today.
But I dont want the current month included.
Any ideas.
Bob
推荐答案
" Bob Wickham" <无线********* @ yahoo.com.au>在留言中写道
news:43 ****** @ dnews.tpgi.com.au ...
"Bob Wickham" <wi*********@yahoo.com.au> wrote in message
news:43******@dnews.tpgi.com.au...
我在子表中有一些sql,它在表中找到日期,但仅当日期
小于今天时
WHERE [MonthYear]<现在()
我希望它能做到这一点,但不包括当前月份。
例如,日期列表以dd / mm / yy格式> 1/01/05
01/02/05
等等
01/11/05
01/12/05
01/01 / 06
01/02/06
如果我今天运行(11/01/06)01/01/06包含在结果中,因为
它小于今天。
但我不想包括当前的月份。
任何想法。
Bob
Hi,
I have some sql in a sub that finds dates in a table but only if the date
is less than today
WHERE [MonthYear] < Now()
I want it to do that but to not include the current month.
For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06
If I run this today (11/01/06) 01/01/06 is included in the result because
it is less than today.
But I dont want the current month included.
Any ideas.
Bob
所以你想要包括当前月份的第一个日期?
您可以使用DateSerial函数:
.... WHERE MyDate< DateSerial(年(日期),月(日期),1)
我假设你的字段[MonthYear]是一个实际的DateTime字段
So you want to include dates less than the first of the current month?
You can use the DateSerial function:
....WHERE MyDate<DateSerial(Year(Date),Month(Date),1)
I''m assuming that your field [MonthYear] is an actual DateTime field
" Bob Wickham" <无线********* @ yahoo.com.au> schreef在bericht新闻:43 ****** @ dnews.tpgi.com.au ...
"Bob Wickham" <wi*********@yahoo.com.au> schreef in bericht news:43******@dnews.tpgi.com.au...
我在子中找到了一些sql表中的日期,但仅在
日期小于今天的情况下
WHERE [MonthYear]<现在()
我希望它能做到这一点,但不包括当前月份。
例如,日期列表以dd / mm / yy格式> 1/01/05
01/02/05
等等
01/11/05
01/12/05
01/01 / 06
01/02/06
如果我今天运行(11/01/06)01/01/06包含在结果中
因为它小于今天。
但我不想包括当前的月份。
任何想法。
Bob
Hi,
I have some sql in a sub that finds dates in a table but only if the
date is less than today
WHERE [MonthYear] < Now()
I want it to do that but to not include the current month.
For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06
If I run this today (11/01/06) 01/01/06 is included in the result
because it is less than today.
But I dont want the current month included.
Any ideas.
Bob
所以你想选择少于当月第一天的所有日期?
WHERE DateField< DateSerial(年(现在),月(现在),1)
Arno R
So you want to select all dates less than the first day of the current month?
WHERE DateField < DateSerial(Year(Now), Month(Now), 1)
Arno R
Arno R < AR *********** @ tiscali.nl>在消息中写道
news:43 *********************** @ text.nova.planet.nl ...
" Bob Wickham" <无线********* @ yahoo.com.au> schreef in bericht
news:43 ****** @ dnews.tpgi.com.au ...
"Arno R" <ar***********@tiscali.nl> wrote in message
news:43***********************@text.nova.planet.nl ...
"Bob Wickham" <wi*********@yahoo.com.au> schreef in bericht
news:43******@dnews.tpgi.com.au...
我在子表中有一些sql,它在表中找到日期,但仅当
日期小于今天
WHERE [MonthYear]<现在()
我希望它能做到这一点,但不包括当前月份。
例如,日期列表以dd / mm / yy格式> 1/01/05
01/02/05
等等
01/11/05
01/12/05
01/01 / 06
01/02/06
如果我今天运行(11/01/06)01/01/06包含在结果中
因为它小于今天。
但我不想包括当前的月份。
任何想法。
Bob
Hi,
I have some sql in a sub that finds dates in a table but only if the
date is less than today
WHERE [MonthYear] < Now()
I want it to do that but to not include the current month.
For instance, a list of dates in dd/mm/yy format
1/01/05
01/02/05
etc
etc
01/11/05
01/12/05
01/01/06
01/02/06
If I run this today (11/01/06) 01/01/06 is included in the result
because it is less than today.
But I dont want the current month included.
Any ideas.
Bob
所以你想选择所有日期少于当前
月的第一天?
WHERE DateField< DateSerial(年份(现在),月份(现在),1)
Arno R
嘿!你在复制我的答案吗?
So you want to select all dates less than the first day of the current
month?
WHERE DateField < DateSerial(Year(Now), Month(Now), 1)
Arno R
Hey! Are you copying my answers?
这篇关于现在()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!