首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

为什么mysql select * from (select * from table)会有语法异常

2012-06-20 
为什么mysql select * from (select * from table)会有语法错误表tablea b c我的sql语句 select into tmpt

为什么mysql select * from (select * from table)会有语法错误
表table
a b c
我的sql语句 select into tmptest from (select * from table)
结果mysql报语法错误,我在网上查似乎sqlserver和oracle都支持这种语法,是不是mysql不支持?
那我应该怎么写,求助...

[解决办法]

SQL code
---mysql不支持者中语法的---创建表create table temptest(id int not null auto_increment,....primary key(id))---插入表inert into tmptest select * from table;
[解决办法]
create table c as 
select a.a,ifnull(a.b,b.e),ifnull(a.c,b.f)
from a inner join b on a.a=b.d
[解决办法]
create table temptest as select * from 
(select * from test2 as b left join kdpumc0614 as a on (b.cname = a.cname or a.`检验项目别名` like concat('%',b.cname,'%') or a.`正式名称` like concat('%',b.cname,'%') or a.`检验项目英文名称` = b.ename or a.`检验项目英文缩写` = b.testalias) and a.sampletype = b.sampletype
union 
select * from test2 as b right join kdpumc0614 as a on (b.cname = a.cname or a.`检验项目别名` like concat('%',b.cname,'%') or a.`正式名称` like concat('%',b.cname,'%') or a.`检验项目英文名称` = b.ename or a.`检验项目英文缩写` = b.testalias) and a.sampletype = b.sampletype
) t

热点排行