Organizational Research By

Surprising Reserch Topic

select mysql query between date

select mysql query between date  using -'mysql,select,date'

How to select data from mysql table past date to current date? For example, Select data from 1 january 2009 until current date ??

My column "datetime" is in datetime date type. Please help, thanks


If let say i want to get day per day data from 1 january 2009, how to write the query? Use count and between function?

asked Sep 16, 2015 by sameer rathore
0 votes

Related Hot Questions

2 Answers

0 votes
select * from *table_name* where *datetime_column* between '01/01/2009' and curdate()

or using >= and <= :

select * from *table_name* where *datetime_column* >= '01/01/2009' and *datetime_column* <= curdate()
answered Sep 16, 2015 by patelnikul321
0 votes

All the above works, and here is another way if you just want to number of days/time back rather a entering date

select * from *table_name* where *datetime_column* BETWEEN DATE_SUB(NOW(), INTERVAL 30 DAY)  AND NOW() 
answered Sep 16, 2015 by kotmus2002