#1
  1. I am still learning
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2002
    Location
    Kuala Lumpur, Malaysia
    Posts
    249
    Rep Power
    13

    Select stmt question on date


    I would like to select all rows from my database where my_date's day is not '01'.

    This are samples what I what I want
    -----------------------------------
    1994-11-14
    2001-01-10


    This are samples what I don't want
    -----------------------------------
    2002-02-01
    2002-01-01
    1998-12-01

    How can I make the query? Currently I am using 'NOT LIKE '%-01'' and I find that this query is very slow.

    Any alternative on this?

    Many thanks
    I have yet to find the right way to do it.

    www.genedavinci.com
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    61
    Use the EXTRACT functions described at http://www.postgresql.org/idocs/inde...-datetime.html
    The real n-tier system:

    FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

    Amazon wishlist -- rycamor (at) gmail.com

IMN logo majestic logo threadwatch logo seochat tools logo