在没有(如果和条件)的情况下显示两个日期之间的日期
Displaying date between two dates without ( IIf and Citeria)
我是访问和编码的新手,所以请多多包涵。
我希望我的 [Exp] 日期介于 1/12/2020 和 1/7/2021 之间 shown/displayed 在 [Exp2] 记录中,如果它不在上述两个日期之间,则 show/display Exp2 记录中没有任何内容。
示例:|
| Exp | Exp2 |
| 1/5/2020 | |
| 3/8/2020 | |
| 12/13/2020| 12.13.2020 |
在 Exp2 中看到只有第三条记录是 shown/displayed 而第一条和第二条是空的。
enter image description here
enter image description here
使用这样的查询:
Select
[Exp],
IIf([Exp] Between #2020-12-01# And #2021-07-01#, [Exp], Null) As Exp2
From
YourTable
或使用子查询(较慢):
Select
[Exp],
(Select
First(T.Exp)
From
YourTable As T
Where
T.Exp = YourTable.Exp
And
T.Exp Between #2020-12-01# And #2021-07-01#) As Exp2
From
YourTable
我是访问和编码的新手,所以请多多包涵。 我希望我的 [Exp] 日期介于 1/12/2020 和 1/7/2021 之间 shown/displayed 在 [Exp2] 记录中,如果它不在上述两个日期之间,则 show/display Exp2 记录中没有任何内容。 示例:|
| Exp | Exp2 |
| 1/5/2020 | |
| 3/8/2020 | |
| 12/13/2020| 12.13.2020 |
在 Exp2 中看到只有第三条记录是 shown/displayed 而第一条和第二条是空的。
enter image description here
enter image description here
使用这样的查询:
Select
[Exp],
IIf([Exp] Between #2020-12-01# And #2021-07-01#, [Exp], Null) As Exp2
From
YourTable
或使用子查询(较慢):
Select
[Exp],
(Select
First(T.Exp)
From
YourTable As T
Where
T.Exp = YourTable.Exp
And
T.Exp Between #2020-12-01# And #2021-07-01#) As Exp2
From
YourTable