select * from (select * from tablename) tem
-- 此处 tem 是为(select * from tablename)给定一个别名
但是下面这个却是错的,
select * from (select * from tablename)当用(select * from tablename)这种查询语句的结果作为表名时必须指定别名。当然,别名可以任意指定。
-- 此处 tem 是为(select * from tablename)给定一个别名
但是下面这个却是错的,
select * from (select * from tablename)当用(select * from tablename)这种查询语句的结果作为表名时必须指定别名。当然,别名可以任意指定。
e.g.select * from
(
select 1 a,2 b,3 c,4 f,5 g
union all
select 5 a,7 b,9 c,3 f,6 g
) a