Table structure settings
CREATE TABLE IF NOT EXISTS `settings` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `value` varchar(255) NOT NULL, `type` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ; Data dump table settings
INSERT INTO `settings` (`id`, `name`, `value`, `type`) VALUES (1, 'title', 'Qeekly', 'core'), (2, 'description', 'Твой собственный маленький мир', 'core'), (3, 'keywords', 'minecraft,сервер,комплекс,qeekly,майнкрафт', 'core'), (4, 'copyright', '«При копировании материалов с сайта, оставайтесь людьми — указывайте ссылку на источник!» Qeekly ©', 'core'), (5, 'charset', 'UTF-8', 'core'), (6, 'offline', '0', 'core'), (7, 'template', 'default', 'core'), (8, 'support', 'support@qeekly.ru', 'mail'), (9, 'noreply', 'noreply@qeekly.ru', 'mail'), (10, 'news', '3', 'lvl'), (11, 'pages', '4', 'lvl'), (12, 'actions', '4', 'lvl'), (13, 'profile', '2', 'lvl'), (14, 'news', '3', 'publish'), (15, 'pages', '4', 'publish'), (16, 'comments', '0', 'publish'); Now actually to the question. I need in ONE sql query to get all the values of the value field where type=core , then c type=lvl , etc.
I think about everything like this:
SELECT `value` FROM `settings` WHERE `type` = 'core' as Core AND `type` = 'lvl' as Lvl AND `type` = 'publish' as Publish I hope clearly explained. Is it possible or should we create several identical queries with different where?
Here is the same code in several sql:
SELECT `value` FROM `settings` WHERE `type` = 'core' SELECT `value` FROM `settings` WHERE `type` = 'lvl' SELECT `value` FROM `settings` WHERE `type` = 'publish'