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 2 of 2
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,958
    Thanks
    120
    Thanked 76 Times in 76 Posts

    handle nonexisting columns

    Code:
    select
    IFNULL(t.AB,t.EN) as L
    FROM
    table t
    EN column exists.
    This is ok if t.AB exists, need it to work even if it does not exists, like:

    Pseudocode:
    Code:
    select
    IFNULL_ERROR(t.AB,t.EN) as L
    FROM
    table t
    Is there something like that ?

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,631
    Thanks
    4
    Thanked 147 Times in 138 Posts
    no, if you try to select from a column that doesn't exist in the table you will get an error.


  •  

    Posting Permissions

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