This topic is locked
[SOLVED]

 Search for a day

5/18/2012 12:59:45 PM
ASPRunnerPro General questions
K
kleanthis author

i have a table that has two days entry, the startDay and the endDay. i want in the advance search to find the records of a specific day let's say 7-8-2012 between those days. How can i do this?
Example
record name startDay endDay

1 kleanthis 15-05-2012 20-05-2012

2 Andrea 18-05-2012 19-05-2012

3 Marion 14-05-2012 18-05-2012
i want to search for the day 17-05-2012 and the results to be

Kleanthis

Marion
I'm running AspRunnet Pro 7.1
Thanks for your help.

Sergey Kornilov admin 5/18/2012

You can use 'Between' search. Use either Advanced search page or search panel for this purpose.

K
kleanthis author 5/18/2012

Yes, but it search in the same coloum and not between the coloum startDay and the coloum endDay.

Sergey Kornilov admin 5/18/2012

I see what you saying.
You can add two search conditions, one condition for each field:

startDay less than 17-05-2012

endDay more than 17-05-2012

K
kleanthis author 5/27/2012

Better solution
WHERE (CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, GETDATE()))) between StartDay and EndDay)
this is for the curent day GETDATE()

and this is for to convert the datatype DateTime to only Date (CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, GETDATE())))
thanks