From: jeff <[EMAIL PROTECTED]>


> I need to be able to search by partial dates.
> What is the best way to search?

You ~could~ do something harsh like:

    SELECT *, substring(myDate, 1, 2) as month
      FROM myFunnyTable
     WHERE month = '06'

But unless you are only going to need this data for a short while, I'd certainly 
reload it into a better format. If you know that you'll have a bunch of funny queries 
to make, like sometimes just month, and sometimes just the year, then it might be 
worth breaking the date into several different formats. Like:

  day        smallint
  month      smallint
  year       smallint
  whole_date datetime

My suggestion would be to use some Perl to accomplish this. I'm sure that other folks 
could show you how to do it all in SQL, but not me. You should understand, the data 
migration process will be as slow as your current queries. But you'll pay a price once 
and not have to pay it again and again.

Let me know if you choose the Perl route and need a hand.


---
Rodney Broom
Programmer: Desert.Net




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to