Finding the month in a birthdate

I'm trying to find all my March birthdates and Anniversaries, as entered in attributes in the format of mm/dd/yyyy.

How would I set up the search to find "03" in the two leftmost characters? 

I'd like to avoid getting anyone that was born/married on the 3rd day of the month.

It seems this is kind of like a reverse wild-card.  Rather than finding within a string of characters, I'm trying to limit it to only specific characters within the field.

Is this even possible?

Parents
  • Chris,

    Something like this should work:

     

     

    select distinct customer_no

     

     

    from tx_cust_keyword

    where

     

    keyword_no = 1

    and substring(key_value, 1,2) = '03'

    A word of warning, if some of your birthdates were from conversion data they may be stored in different formats - for example YYYY-MM-DD or something else crazy.  Values in tx_cust_keyword are stored as text so there could be anything in there.  I would check before you run any restrictive criteria like the one above.

    Dale

Reply
  • Chris,

    Something like this should work:

     

     

    select distinct customer_no

     

     

    from tx_cust_keyword

    where

     

    keyword_no = 1

    and substring(key_value, 1,2) = '03'

    A word of warning, if some of your birthdates were from conversion data they may be stored in different formats - for example YYYY-MM-DD or something else crazy.  Values in tx_cust_keyword are stored as text so there could be anything in there.  I would check before you run any restrictive criteria like the one above.

    Dale

Children