i
i have a table. this picture is a part of my table:
http://www.khodabakhsh.info/record.jpg
also this is sql of this table:
CREATE TABLE `formdata` (
`id` int(11) NOT NULL auto_increment,
`field_name` text collate utf8_persian_ci NOT NULL,
`value` text collate utf8_persian_ci NOT NULL,
`record` bigint(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_persian_ci AUTO_INCREMENT=7 ;
INSERT INTO `formdata` VALUES (1, 'fname', 'jorj', 1);
INSERT INTO `formdata` VALUES (2, 'lname', 'bush', 1);
INSERT INTO `formdata` VALUES (3, 'fname', 'oliver', 2);
INSERT INTO `formdata` VALUES (4, 'lname', 'kinton', 2);
INSERT INTO `formdata` VALUES (5, 'fname', 'larry', 3);
INSERT INTO `formdata` VALUES (6, 'lname', 'bush', 3);
now i want to select data where value for eaxmple is 'bush' and converting columns data to rows data. result must like this:
record fname lname
1 jorj bush
3 larry bush
is it a way for doing this?