Imagine the scenario,
I have a table Day_fee(date(Date),fee(Integer))
I want to have a list with only the months of the table, for example:
Day_fee
date(Date) fee(Int)
----------|---------
2012/03/27 1
2012/03/26 2
2012/03/25 2
2012/05/01 3
2012/05/02 3
2012/07/01 2
2013/04/01 2
2013/05/01 1
The result => a list with 03, 05 and 07 , without repeat the months.
And the other big question:
I would want a hash o list with month and year, for example {“03″=>”2012″,”04″=>”2013″,”05″=>”2013”, “05”=>”2012″, “07”=>”2012″} , without repeat the months, maybe the table can have more years with the same month
Beacuse, after that, i want to show a html table with the months and paginate that.
Thoughts?
Thanks for your help.
Try this:
If you are using Postgres DB
If you are using MySQL
Edit
Based on your comment, it looks like you want a different data:
Postgres
MySQL
To get a 2D array
To get hash with collection of years