sql打印两个给定日期之间的日期

问题描述:

任何1帮我写sql打印两个给定日期之间的日期。即两个日期,例如(01-12-2006和05-12-2006),并希望打印日期,如01-12-2006

02-12-2006

03-12-2006

04-12-2006

05-12-2006

提前感谢

any 1 help me to write sql to print dates between two given dates. ie two dates are given for example (01-12-2006 and 05-12-2006) and want to print dates like 01-12-2006
02-12-2006
03-12-2006
04-12-2006
05-12-2006
thanks in advance

http://stackoverflow.com/questions/1378593/get-a-list-of-dates-between-two-dates-using-a-function [ ^ ]

http://forums.asp.net/t/1761386.aspx?How+to+create+a+flipcart+like+panel+for+showing+products+in+gridview [ ^ ]


假设您使用的是sql server:

Assuming you are using sql server:
SELECT * FROM table1
WHERE CONVERT(date, nameofdatefield, 105) BETWEEN '01-12-2006' and '05-12-2006'


在运营商之间尝试使用: -



try this use between operator:-

SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value1 AND value2;





例如: -



eg:-

SELECT dates
FROM orders
WHERE order_date BETWEEN TO_DATE ('2003/01/01', 'yyyy/mm/dd')
AND TO_DATE ('2003/12/31', 'yyyy/mm/dd');





参考: -

http://www.w3schools.com/sql/sql_between.asp [ ^ ]