MySQL Forums
Forum List  »  General

Re: how to specify custom day start and day end time
Posted by: Peter Brawley
Date: March 15, 2015 11:13PM

> I don't want to create any table in database on temp basis

Why in twe world not!?

Sure, you could make it a subquery, eg ...

select ...
from (
  select distinct  
  concat( date(timestamp), ' 16:30:00' ) as tbegin,  
  concat(date(timestamp)+interval 1 day, ' 16:29:59' ) as tend  
  from transactionsession;  
) cal
join transactionsession on ...

but it will probably perform more slowly, how much more slowly depending on your mysql version.

> results on some dates are not proper

Can't debug such sql without the data. Post a Create Table command along with enough Inserts to demonstrate the errors you are finding.



Edited 1 time(s). Last edit at 03/16/2015 10:51AM by Peter Brawley.

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.