MySQL Forums
Forum List  »  General

Re: how to specify custom day start and day end time
Posted by: Devrishi Shandilya
Date: March 16, 2015 02:55AM

Hi Peter,

I created cal table and there are 32 rows.Now I need to get count(*) from transactionsession table for every tbegin and tend from cal table. in my query if i do group by date(timestamp), it returns me results based on date but i need count(*) for every cal record. i.e. tbegin and tend in cal table.

mysql> select * from cal;
+---------------------+---------------------+
| tbegin | tend |
+---------------------+---------------------+
| 2015-02-06 18:30:00 | 2015-02-07 18:29:59 |
| 2015-02-07 18:30:00 | 2015-02-08 18:29:59 |
| 2015-02-08 18:30:00 | 2015-02-09 18:29:59 |
| 2015-02-09 18:30:00 | 2015-02-10 18:29:59 |
| 2015-02-10 18:30:00 | 2015-02-11 18:29:59 |
| 2015-02-11 18:30:00 | 2015-02-12 18:29:59 |
| 2015-02-12 18:30:00 | 2015-02-13 18:29:59 |
| 2015-02-13 18:30:00 | 2015-02-14 18:29:59 |
| 2015-02-14 18:30:00 | 2015-02-15 18:29:59 |
| 2015-02-15 18:30:00 | 2015-02-16 18:29:59 |
| 2015-02-16 18:30:00 | 2015-02-17 18:29:59 |
| 2015-02-17 18:30:00 | 2015-02-18 18:29:59 |
| 2015-02-18 18:30:00 | 2015-02-19 18:29:59 |
| 2015-02-19 18:30:00 | 2015-02-20 18:29:59 |
| 2015-02-20 18:30:00 | 2015-02-21 18:29:59 |
| 2015-02-21 18:30:00 | 2015-02-22 18:29:59 |
| 2015-02-22 18:30:00 | 2015-02-23 18:29:59 |
| 2015-02-23 18:30:00 | 2015-02-24 18:29:59 |
| 2015-02-24 18:30:00 | 2015-02-25 18:29:59 |
| 2015-02-25 18:30:00 | 2015-02-26 18:29:59 |
| 2015-02-26 18:30:00 | 2015-02-27 18:29:59 |
| 2015-02-27 18:30:00 | 2015-02-28 18:29:59 |
| 2015-02-28 18:30:00 | 2015-03-01 18:29:59 |
| 2015-03-01 18:30:00 | 2015-03-02 18:29:59 |
| 2015-03-02 18:30:00 | 2015-03-03 18:29:59 |
| 2015-03-03 18:30:00 | 2015-03-04 18:29:59 |
| 2015-03-04 18:30:00 | 2015-03-05 18:29:59 |
| 2015-03-05 18:30:00 | 2015-03-06 18:29:59 |
| 2015-03-06 18:30:00 | 2015-03-07 18:29:59 |
| 2015-03-07 18:30:00 | 2015-03-08 18:29:59 |
| 2015-03-08 18:30:00 | 2015-03-09 18:29:59 |
| 2015-03-09 18:30:00 | 2015-03-10 18:29:59 |
+---------------------+---------------------+
32 rows in set (0.00 sec)

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.