Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    419
    Thanks
    18
    Thanked 2 Times in 2 Posts

    ifnull not working

    I'm trying to pull results, and fill any empty fields with 'foo' But it's not working. It just pulls existing results and no empty ones saying 'foo'


    I tried coalesce too but, no difference.


    Here's what:

    Code:
    SELECT DISTINCT COALESCE(plant_name,'foo') FROM plantae
    WHERE taxonomic_genus = 'Abies' AND scientific_name = 'balsamea' AND infraspecific_epithet = ''
    OR taxonomic_genus = 'Abutilon' AND scientific_name = 'theophrasti' AND infraspecific_epithet = ''
    OR taxonomic_genus = 'Acalypha' AND scientific_name = 'rhomboidea' AND infraspecific_epithet = ''
    OR taxonomic_genus = 'Acer' AND scientific_name = 'ginnala' AND infraspecific_epithet = ''
    OR taxonomic_genus = 'Acer' AND scientific_name = 'negundo' AND infraspecific_epithet = ''
    OR taxonomic_genus = 'Acer' AND scientific_name = 'negundoxxxxinterius' AND infraspecific_epithet = ''
    OR taxonomic_genus = 'Acer' AND scientific_name = 'negundoxxxxnegundo' AND infraspecific_epithet = ''

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    419
    Thanks
    18
    Thanked 2 Times in 2 Posts
    just realized I didn't quite explain myself right. I was trying to say I tried both ifnull and coalesce, to no luck.

  • #3
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,994
    Thanks
    120
    Thanked 76 Times in 76 Posts
    what do you expect ?
    max 7 records ?
    or max > 7 records ?

    besides I think you should put some parenthesis in, like:
    Code:
    where (taxonomic_genus = 'Abies' AND scientific_name = 'balsamea' AND infraspecific_epithet = '') OR ( .....
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search


  •  

    Posting Permissions

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