drop view if exists v1; drop table if exists t1; create table t1 ( table1_id bigint not null auto_increment, sort_order int(11), c1 varchar(255), primary key (`table1_id`) ) engine=InnoDB default charset=utf8 ; create view v1 as select t1.*, (select 0) x from t1 order by sort_order ; insert into t1 (sort_order, c1) values (2, "a"),(9, "b"),(4, "c"), (7, "a"),(5, "b"),(3, "c"), (6, "a"),(1, "b"),(8, "c") ; select * from v1 ; select * from v1 where c1 = "a" ;