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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -