Every derived table must have its own alias
错误复现:
在写带有子查询或者在查询时产生临时表的查询时,可能会出现这个错误:
ERROR 1248 (42000): Every derived table must have its own alias
意思是「每一个派生出来的表都必须给它命名一个自己的别名」

错误的sql示例:
select dataid FROM (
select dataid ,if(dataid in (select ID from aip_1732602471460208641_file where ID in(1095884)),"yes","no")AS results from gf_file where aipId = 1732602471460208641 ) where results = 'no' Limit 1
错误原因:
执行这个sql时就会产生一张新的表,和前面的表联合查询
select dataid ,if(dataid in (select ID from aip_1732602471460208641_file where ID in(1095884)),"yes","no")AS results from gf_file where aipId = 1732602471460208641
但是mysql要求每一个派生出来的表都必须有一个自己的别名,那我给派生表加上别名即可;
eg:修改后的sql,直接在新生产的表中加入 他的别命名就行(“as a”或者“a”),“a”为新表的别名
select dataid FROM (
select dataid ,if(dataid in (select ID from aip_1732602471460208641_file where ID in(1095884)),"yes","no")AS results from gf_file where aipId = 1732602471460208641 ) AS a where results = 'no' Limit 1