Home > Database > Mysql Tutorial > SQL 返回期间内的所有日期

SQL 返回期间内的所有日期

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:58:55
Original
1117 people have browsed it

就是实现时间段内的所有日期的sql语句,非常的不错,大家可以参考下。

代码如下:
select rownum as dateIndex,to_date('20090701','yyyy-mm-dd')+ rownum-1 AS DATE_ FROM DUAL CONNECT BY LEVEL >= 1 AND LEVEL

result:

1 2009/07/01
2 2009/07/02
3 2009/07/03
4 2009/07/04
5 2009/07/05
6 2009/07/06
7 2009/07/07
8 2009/07/08
9 2009/07/09
10 2009/07/10
11 2009/07/11
12 2009/07/12
13 2009/07/13
14 2009/07/14
15 2009/07/15
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
sql file
From 1970-01-01 08:00:00
0
0
0
php - Overhead of prepare vs sql?
From 1970-01-01 08:00:00
0
0
0
Print sql statement
From 1970-01-01 08:00:00
0
0
0
Pass array to SQL insert query using PHP
From 1970-01-01 08:00:00
0
0
0
sql optimization or
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template