Three parameters start time and end time, interval Demand is: in the start time and end time, carried out in accordance with the specified time interval a grouping, such as the start time for the 2020-07-10 08:00:00 End time for the 2020-07-11 08:00:00 time interval for 30 minutes Is divided into 2020-07-10 08:00:00-2020-07-10 08:30:00 so on until the end of the 2020-07-11 07:30:00-2020-07-11 08:00:00 how to write SQL statements, have who can help me
CodePudding user response:
Select ceil ((to_date (' 09:30:00 2020-07-11 ', '- dd yyyy - mm hh24: mi: ss') - start time) * 24 * 60/30) The from tab_name The where... ;