I want to select records from a table that has a date between 28-02-2012 to 30-30-2012
Does any one know how to do this, please answer it
Thanks
i want data like this after run the query
proname pc1tot pc2tot allpctot
sample1 10 12 22
SELECT * FROM table_name WHERE date_col BETWEEN '2012-02-28' AND '2012-03-30'
I assume this is typo- Not 2012-30-30
, It is 2012-03-30
try this
select * from table1 where field_val between 28-02-2012 and 30-30-2012
Without a table schema, here's the principle:
select myDate, other fields...
from myTable
where myDate >= '2012-02-28' and myDate <= '2012-03-30'
You can also use "between" in some databases:
select myDate, other fields...
from myTable
where myDate between '2012-02-28' and '2012-03-30'
There are similar answers for your question.
SELECT * FROM TABLE WHERE DATE BETWEEN '28-02-2012' AND '30-02-2012'
You ought to store your dates not in day-month-year format but format required by mysql - year-month-day.
So, you have to change your table structure.