MySQL queries to update conference descriptions

User: tom
Created: February 24th, 2010
Topic: MySQL queries to update conference descriptions
Message Id: 54
Conference: General
Reads: 153
Weblog Permalink: http://www.tomswebhosting.com/2010/02/24/#54
Tags: code, mysql, software, sql, subquery
Topic Feed:
Navigation: << < ^ ^^ > >>

Here are MySQL queries for my records with use of a subquery to update empty conference descriptions.

UPDATE `message` SET `content_markup` = IF( `content_markup` = '', 'uploaded files are added here', `content_markup` ), `content` = `content_markup` WHERE `id` = (SELECT `conference_message_id_files` FROM `configuration`);

UPDATE `message` SET `content_markup` = IF( `content_markup` = '', "put the topic here if it doesn't fit elsewhere", `content_markup` ), `content` = `content_markup` WHERE `id` = (SELECT `conference_message_id_general` FROM `configuration`);

UPDATE `message` SET `content_markup` = IF( `content_markup` = '', 'uploaded images are added here', `content_markup` ), `content` = `content_markup` WHERE `id` = (SELECT `conference_message_id_images` FROM `configuration`);

UPDATE `message` SET `content_markup` = IF( `content_markup` = '', 'optionally add webpages here', `content_markup` ), `content` = `content_markup` WHERE `id` = (SELECT `conference_message_id_webpages` FROM `configuration`);