On a table view, click a column to order by that column. Then execute a UNION query with that table and another one (with the ordered table coming second).
An error comes back: #1054 - Unknown column 'sortunion2.id' in 'order clause'
Here is a sample table definition:
CREATE TABLE IF NOT EXISTS `sortunion1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; INSERT INTO `sortunion1` (`id`, `name`) VALUES (1, 'aaa'), (2, 'bbb'); CREATE TABLE IF NOT EXISTS `sortunion2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; INSERT INTO `sortunion2` (`id`, `name`) VALUES (1, 'vvv'), (2, 'xxx'), (3, 'yyy'), (4, 'zzz');
Sort by the id on sortunion2, then run this:
SELECT * FROM `sortunion1` UNION SELECT * FROM `sortunion2`
I am also unable to find a way to remove the table sorting. It seems like without that the query would work.
Edit: realised that table sorting is stored in the phpmyadmin meta tables, so I can find the appropriate row and remove it. Would be much better to have a way to clear that on the table view though.
Last edit: DisgruntledGoat 2013-11-18
As a temporary workaround you can disable remembering table's sort order. To do this, go to Settings -> Main Panel -> Browse Mode -> untick Remember table's sorting
Hello, I am new to this community. I am trying my hands on this bug.
Bug fixed
https://github.com/phpmyadmin/phpmyadmin/pull/779
Thanks
Fixed in https://github.com/phpmyadmin/phpmyadmin/commit/274943c0c5979b8f789ad15e949c1c7ff0af7577