> 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.