Jump to content

Select Where With Datetime Fields


Jandre

Recommended Posts

Folks,I have a relatively complex select query with several joins. There is a simple where clause which works on a datetime field. Currently it works fine if I specify the Date and Time. I assume it would also work fine if I used a between clause and specified date and time. I want however to include all records between certain dates that fit three time criteria. Those at 09:00:00, 11:25:00 & 13:30:00. It's not sufficient to search for 'DATE 09:00:00' OR 'DATE 11:25:00' OR 'DATE 13:30:00' as I want to search ebtween dates?Edit: I've just realised that this isn't clear - what I meant to say was that I don't want to search three times on one specific date. I'd like toreturn instances of the three times between two dates. That would mean six clauses if using two dates, nine if using three days, etc. Any thoughts on how to do this?ThanksJason

Link to comment
Share on other sites

Hi, i don't know the details of why to use three date criteria but you could only use the min and max date and continue to use the between, i guess you could be doing the comparasion in your server language.hope this helps

Link to comment
Share on other sites

You may want to use sub-queries, comparisons, logical etc. though I assumed that these are what you need in your statement. Do you want to return all result between these time; 09:00:00, 11:25:00, 13:30:00?

Link to comment
Share on other sites

In the data table there will be results at a few times, but most will be 9:00, 11:25 or 13:30. I only want these. I did think about returning the date and time as two seperate columns using the convert function and fltering these. Would that work? I'm not in front of the server to check that yet!Thanks

You may want to use sub-queries, comparisons, logical etc. though I assumed that these are what you need in your statement. Do you want to return all result between these time; 09:00:00, 11:25:00, 13:30:00?
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...