MySQL Forums
Forum List  »  PHP

Re: Query with overall date range and start/end time ranges
Posted by: Rick James
Date: May 02, 2012 11:24PM

> I have no control over the originating database structure, so I'm stuck with the separate date and time fields
Can't you combine them as you transfer the data, thereby solving the problem?

> no way that I know to formulate an iSeries query to combine them
What is iSeries?
How about this: Use your tools to load the data, then
1. create a new table
2. run an INSERT ... SELECT ... to populate the new table from the loaded table, fixing datetime in this process.

Or combine the fields in the WHERE clause.

If you have
d DATE,
t TIME
Then they can be combined thus (I think):
d + INTERVAL time_to_sec(t) SECOND
That might be worth it, even though the WHERE clause would be messy because it would have a few of those, and it would not be able to use any indexes on d or t

> if(($L[PDATE] == $SDate && $L[PTIME] < $StartTime) || ($L[PDATE] == $EDate && $L[PTIME] > $EndTime))
Eh? Seems like that should be in the WHERE clause, not in PHP.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.