Skip to main content
Inspiring
February 11, 2010
Question

Sort by Month

  • February 11, 2010
  • 1 reply
  • 534 views

Hi
I have create a site in which a solicitors add a client. When they add the client it automatially generates the date and put this into a field in my db called date added.It adds it dd-mm-yyyy. I want to be able to sort ignoring the dd. So if they wanted to see all the cases added in jan 2010 it would do so or if it was june 2010 we could do this.

Any suggestions on the best way to do this

This topic has been closed for replies.

1 reply

Inspiring
February 11, 2010

First, if your datatype is char or varchar, change it to date or datetime, whatever is appropriate for your db.

Second, different dbs have different functions that will help you.  What type of db do you have?

Inspiring
February 11, 2010

It is unfortunatly a Access Database at the present time. It was a text field but i have changed it to date

Inspiring
February 11, 2010

A quick google search on "ms access date functions" shows me functions named year and month.  They look promising.  The logic would be to use them to include the year and month in your select clause, and then order by those two columns.