我需要BETWEEN的速度 [英] I need BETWEEN on speed
问题描述
这是x-posted in:
alt.php.sql
comp.databases.ms-sqlserver
microsoft.public。 sqlserver.programming
我有白天发生的事件。我希望能够通过带有复选框的表格(多选)来搜索那些
。
例如,假设发生了一个事件3-10pm。当有人
搜索4-6(复选框选项)时,它需要显示。
我不需要代码,因为我只需要理论。我的理论是我编写了
并且工作,理论上只是一个见解如下。我做了一个BETWEEN致电
,它拉开了任何在4和6之间开始或在4和6之间结束的事件。
你可以看到。事件跨越那个时间,但是没有开始或停止在4到6之间的
,因此没有被拉。哎呀。
所以,如果有人打电话告诉我另一个功能或者更好的方式
使用BETWEEN会很棒。我不认为这个时刻的代码是必要的,所以保存''请发布代码''帖子:)谢谢。
This is x-posted in:
alt.php.sql
comp.databases.ms-sqlserver
microsoft.public.sqlserver.programming
I have events that occur during the day. I want to be able to search those
by a form with checkboxes (multiple select).
Let''s say for instance an event is happening from 3-10pm. When someone
searches for 4-6 (checkbox option) it needs to show up.
I don''t need code so much as I just need theory. My theory that I coded out
and worked, just a missight in theory is as follows. I did a BETWEEN call
that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND 6.
As you can see. The event spans that time, but does not start or stop
between 4 and 6, thus was not pulled. Ooops.
So if someone call tell me of another function or perhaps just a better way
to use BETWEEN that would be great. I don''t think that code is necessary at
this juncture, so save the ''Please post code'' post :) Thanks.
推荐答案
如果datetime列上有索引,则使用> =和<而不是
BETWEEN。
但是只要你添加一个OR子句,这可能会破坏计划。
-
http://www.aspfaq.com/
(反向地址回复。)
" Rizyak" < RY ********** @ latitude47.comANDMETOO>在消息中写道
news:cb ********** @ gnus01.u.washington.edu ...
If there is an index on the datetime column, then use >= and < rather than
BETWEEN.
But as soon as you add an OR clause, this might really muck up the plan.
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Rizyak" <ry**********@latitude47.comANDMETOO> wrote in message
news:cb**********@gnus01.u.washington.edu...
这是x-posted in:
alt.php.sql
comp.databases.ms-sqlserver
microsoft.public.sqlserver.programming
我有白天发生的事件。我希望能够通过带有复选框的表单(多选)来搜索那些
。
比方说,事件发生在下午3点到10点。当有人
搜索4-6(复选框选项)时,它需要显示出来。
我不需要代码,因为我只需要理论。我将
编码出来并且工作的理论如下,只是理论上的一个看法。我做了一个BETWEEN电话
拉出任何在4和6之间开始或在4和6之间结束的事件。
正如你所看到的那样。事件跨越那个时间,但不会在4到6之间开始或停止,因此没有被拉动。哎呀。
所以,如果有人打电话告诉我另一个功能,或者可能只是一个更好的
方式来使用BETWEEN,这将是很棒的。在这个时刻我不认为代码是必要的
,所以请保存''请发布代码''帖子:)谢谢。
This is x-posted in:
alt.php.sql
comp.databases.ms-sqlserver
microsoft.public.sqlserver.programming
I have events that occur during the day. I want to be able to search those
by a form with checkboxes (multiple select).
Let''s say for instance an event is happening from 3-10pm. When someone
searches for 4-6 (checkbox option) it needs to show up.
I don''t need code so much as I just need theory. My theory that I coded out and worked, just a missight in theory is as follows. I did a BETWEEN call
that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND 6.
As you can see. The event spans that time, but does not start or stop
between 4 and 6, thus was not pulled. Ooops.
So if someone call tell me of another function or perhaps just a better way to use BETWEEN that would be great. I don''t think that code is necessary at this juncture, so save the ''Please post code'' post :) Thanks.
starttime< = 6 AND endtime> = 4
-
Jacco Schalkwijk
SQL服务器MVP
Rizyak < RY ********** @ latitude47.comANDMETOO>在消息中写道
news:cb ********** @ gnus01.u.washington.edu ...
starttime <= 6 AND endtime >= 4
--
Jacco Schalkwijk
SQL Server MVP
"Rizyak" <ry**********@latitude47.comANDMETOO> wrote in message
news:cb**********@gnus01.u.washington.edu...
这是x-posted in:
alt.php.sql
comp.databases.ms-sqlserver
microsoft.public.sqlserver.programming
我有白天发生的事件。我希望能够通过带有复选框的表单(多选)来搜索那些
。
比方说,事件发生在下午3点到10点。当有人
搜索4-6(复选框选项)时,它需要显示出来。
我不需要代码,因为我只需要理论。我将
编码出来并且工作的理论如下,只是理论上的一个看法。我做了一个BETWEEN电话
拉出任何在4和6之间开始或在4和6之间结束的事件。
正如你所看到的那样。事件跨越那个时间,但不会在4到6之间开始或停止,因此没有被拉动。哎呀。
所以,如果有人打电话告诉我另一个功能,或者可能只是一个更好的
方式来使用BETWEEN,这将是很棒的。在这个时刻我不认为代码是必要的
,所以请保存''请发布代码''帖子:)谢谢。
This is x-posted in:
alt.php.sql
comp.databases.ms-sqlserver
microsoft.public.sqlserver.programming
I have events that occur during the day. I want to be able to search those
by a form with checkboxes (multiple select).
Let''s say for instance an event is happening from 3-10pm. When someone
searches for 4-6 (checkbox option) it needs to show up.
I don''t need code so much as I just need theory. My theory that I coded out and worked, just a missight in theory is as follows. I did a BETWEEN call
that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND 6.
As you can see. The event spans that time, but does not start or stop
between 4 and 6, thus was not pulled. Ooops.
So if someone call tell me of another function or perhaps just a better way to use BETWEEN that would be great. I don''t think that code is necessary at this juncture, so save the ''Please post code'' post :) Thanks.
Rizyak,
EventStartTime< = BetweenEndTime
AND
EventEndTime> = BetweenStartTime
Russell Fields
" Rizyak" < RY ********** @ latitude47.comANDMETOO>在消息中写道
news:cb ********** @ gnus01.u.washington.edu ...
Rizyak,
EventStartTime <= BetweenEndTime
AND
EventEndTime >= BetweenStartTime
Russell Fields
"Rizyak" <ry**********@latitude47.comANDMETOO> wrote in message
news:cb**********@gnus01.u.washington.edu...
这是x-posted in:
alt.php.sql
comp.databases.ms-sqlserver
microsoft.public.sqlserver.programming
我有白天发生的事件。我希望能够通过带有复选框的表单(多选)来搜索那些
。
比方说,事件发生在下午3点到10点。当有人
搜索4-6(复选框选项)时,它需要显示出来。
我不需要代码,因为我只需要理论。我将
编码出来并且工作的理论如下,只是理论上的一个看法。我做了一个BETWEEN电话
拉出任何在4和6之间开始或在4和6之间结束的事件。
正如你所看到的那样。事件跨越那个时间,但不会在4到6之间开始或停止,因此没有被拉动。哎呀。
所以,如果有人打电话告诉我另一个功能,或者可能只是一个更好的
方式来使用BETWEEN,这将是很棒的。在这个时刻我不认为代码是必要的
,所以请保存''请发布代码''帖子:)谢谢。
This is x-posted in:
alt.php.sql
comp.databases.ms-sqlserver
microsoft.public.sqlserver.programming
I have events that occur during the day. I want to be able to search those
by a form with checkboxes (multiple select).
Let''s say for instance an event is happening from 3-10pm. When someone
searches for 4-6 (checkbox option) it needs to show up.
I don''t need code so much as I just need theory. My theory that I coded out and worked, just a missight in theory is as follows. I did a BETWEEN call
that pulled any event that began BETWEEN 4 AND 6 or ended BETWEEN 4 AND 6.
As you can see. The event spans that time, but does not start or stop
between 4 and 6, thus was not pulled. Ooops.
So if someone call tell me of another function or perhaps just a better way to use BETWEEN that would be great. I don''t think that code is necessary at this juncture, so save the ''Please post code'' post :) Thanks.
这篇关于我需要BETWEEN的速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!