I don't know if this is optimal or not, but it does work... DROP TABLE IF EXISTS `x`; CREATE TABLE `x` ( `id` int(11) default NULL, `path1` varchar(10) default NULL, `display` varchar(10) default NULL, `value` varchar(10) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
insert into x values (1, 'ostype','os','windows'), (1,'ostype','ver','NT4'), (2,'ostype','os','linux'), (2,'ostype','ver','RHEL 5.4'); select distinct id, (select value from x x1 where x.id=x1.id and display='os') os, (select value from x x2 where x.id=x2.id and display='ver') ver from x Tim ________________________________________ From: Jacob, Raymond A Jr [mailto:[EMAIL PROTECTED] Sent: Saturday, March 17, 2007 12:05 AM To: mysql@lists.mysql.com Subject: How does one transpose a group of columns into rows? I have a table: Id |path1 | display| value 1 | ostype | os |windows 1 | ostype | ver |NT4 2 | ostype | os | linux 2 | ostype | ver | RHEL 5.4 That I would like to tranform into Id | os | ver 1 |windows | NT4 2| linux |RHEL 5.4 Thank you, Raymond -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]