Results 1 to 2 of 2

Thread: IFNULL syntax (complicated)

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,709
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default IFNULL syntax (complicated)

    The following is actually a simplified version of the SQL I am trying to run
    Code:
    SELECT ID, summary, IFNULL(image,0) as mee FROM memoblog WHERE (lcase( concat(cast(ID as 
    char), summary, image)) LIKE '%yoo%' )
    summary='yoo'
    image=NULL
    ID=3

    If any of the columns are NULL the whole thing will be considered NULL. I would like to give "image" a value that is close to NULL without invalidating the whole query. I'm still seeing what I can find. It seems like every example I try from other sites just won't work.
    Last edited by james438; 01-12-2010 at 06:54 AM.
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,709
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    Here is the solution I came up with:

    Code:
    SELECT ID, summary, image FROM memoblog WHERE (lcase( concat(cast(ID as 
    char), summary, IFNULL(image,''))) LIKE '%yoo%' )
    I was sure I had tried this earlier though.
    Last edited by james438; 01-12-2010 at 06:54 AM.
    To choose the lesser of two evils is still to choose evil. My personal site

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •