修改日期的 InTime 和 OutTime?
使用 SQL Server 2000 表
CARDNO CARDEVENTDATE CARDEVENTDATE CARDEVENTTIME
ADJUSTED
0121 20090611 20090610 025050
0121 20090611 20090611 040000
0121 20090611 20090611 050000
0121 20090612 20090611 020000
0122 20090611 20090611 030001
0122 20090612 20090611 030000
0123 20090611 20090611 080000
0123 20090611 20090611 100000
0123 20090611 20090611 132449
0123 20090612 20090611 025959
0124 20090611 20090610 030000
0124 20090612 20090612 030001
0125 20090611 20090611 030002
0125 20090612 20090612 040000
从上表中,我想显示特定卡事件的 Intime 和 Outtime 调整日期
保留 CardEventDate。
我想显示 Cardno、CardeventDateAdjusted、Cardeventtime
Cardno – 121
CardeventDateAdjusted - 20090611
Intime – 040000, Outtime – 020000
Cardno – 121
CardeventDateAdjusted - 20090610
Intime – 025050, Outtime – No
Cardno – 122
CardeventDateAdjusted - 20090611
Intime – 030001, Outtime – 030000
……。 如此看来,
银泰应该> 030000 且超时应 < 030001 根据卡片事件日期调整。
在 Cardeventtime 列中,根据 Cardno、Cardeventdate adjustment,第一个值应采用 Intime,最后一个值应采用 Outtime。
预期输出像这样。
CARDNO CARDEVENTDATE INTIME OUTTIME
ADJUSTED
0121 20090611 040000 020000
0121 20090610 025050 -
0122 20090611 030001 030000
0123 20090611 080000 025959
0124 20090610 030000 -
0124 20090612 030001 -
0125 20090612 040000 -
0125 20090611 030002 -
输出时间中有空白列,因为该日期没有超时。 所以我需要这样的输出。
Using SQL Server 2000
Table
CARDNO CARDEVENTDATE CARDEVENTDATE CARDEVENTTIME
ADJUSTED
0121 20090611 20090610 025050
0121 20090611 20090611 040000
0121 20090611 20090611 050000
0121 20090612 20090611 020000
0122 20090611 20090611 030001
0122 20090612 20090611 030000
0123 20090611 20090611 080000
0123 20090611 20090611 100000
0123 20090611 20090611 132449
0123 20090612 20090611 025959
0124 20090611 20090610 030000
0124 20090612 20090612 030001
0125 20090611 20090611 030002
0125 20090612 20090612 040000
From the Above table I want to display Intime and Outtime for the Particular Card Event Adjusted Date
Leave the CardEventDate.
I want to Show Cardno, CardeventDateAdjusted, Cardeventtime
Cardno – 121
CardeventDateAdjusted - 20090611
Intime – 040000, Outtime – 020000
Cardno – 121
CardeventDateAdjusted - 20090610
Intime – 025050, Outtime – No
Cardno – 122
CardeventDateAdjusted - 20090611
Intime – 030001, Outtime – 030000
………. So on,
Intime should > 030000 and Outtime should < 030001 according to the cardeventdateadjusted.
In Cardeventtime column, the First value should take Intime and Last value should take Outtime according to Cardno, Cardeventdateadjusted.
Expected Output Like this.
CARDNO CARDEVENTDATE INTIME OUTTIME
ADJUSTED
0121 20090611 040000 020000
0121 20090610 025050 -
0122 20090611 030001 030000
0123 20090611 080000 025959
0124 20090610 030000 -
0124 20090612 030001 -
0125 20090612 040000 -
0125 20090611 030002 -
There is Blank column in output time, because there is no Outtime on the Date. So I need Output Like this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我知道这会很难看,但你可以......
OK, I know it's going to be uggly, but you can do...
编辑:问题在编辑中已被更改,以至于长而详细的答案与其当前状态无关,所以我也从头开始。
该请求不明确(从未明确指定什么是及时的,什么是超时的)并且显然是矛盾的。 例如,一个请求是:
但另一个指定点是
问题中的信息为零,因为它现在代表“根据”可能意味着什么(它可能暗示或需要什么算术操作)。 忽略这个完全未指定的附带条件,您要求查看 025050 并且还要求它 > 030000:算术定律禁止这样做。
我已经浪费了太多时间试图读懂你的想法并解决矛盾和歧义——这变得越来越荒谬了。 除非下一次编辑产生一个明确的、明确的、不矛盾的规范,否则我就离开这里。
Edit: the question's been altered in edit to the point that the long, detailed answer had nothing to do with its current state, so I'm also restarting from scratch.
The request is ambiguous (it's never clearly specified what's intime and what's outtime) and apparently contradictory. For example one request is:
but another specified point is
There's zero info in the question as it now stands about what the "according to" might mean (what arithmetic manipulations it might imply or require). Ignoring this totally-unspecified proviso, you're asking to see 025050 and ALSO asking that it be > 030000 : the laws of arithmetic prohibit that.
I've wasted far too many hours on trying to read your mind and resolve contradictions and ambiguities -- it's getting ridiculous. Unless the next edit produces a well-specified, non-ambiguous, non-contradictory spec, I'm outta here.