MySQL IF NOT EXISTS / IFNULL SELECT other column -
i want check, if column (mysql) exists. if not, mysql should take value column exists. query looks this, not work:
if not exists (select `en` `hp_strings` `name`='copyright' , `group`='system') select `default` `hp_strings` `name`='copyright' , `group`='system'; i tried
ifnull((select `en` `hp_strings` `name`='copyright' , `group`='system'), (select `default` `hp_strings` `name`='copyright' , `group`='system')); same result (error)
edit: 'en' not exist. want know, if exists.
to inspect table structure in mysql, have query information_schema database. that, db user must have access system database (which regular user shouldn't have).
i don't know trying do, should rethink database structure doesn't require checking if column exists in table.
Comments
Post a Comment