SQL错误(1327):Undeclared variable:tableName

SQL错误(1327):Undeclared variable:tableName_第1张图片
在MySQL中使用

select 
*
  into 
  tableName
from 
AOFS_ADJ  

时,会报上边的错误,这是因为MySQL不支持这种语法,它的替代语法是这样的:

create table zhang123
(select 
*
from AOFS_ADJ  
)

这样就可以正常执行了。
分享一个我的关联查询生成中间表的SQL:

Create table zhang123
(select 
AOFS_ADJ.name,AOFS_ADJ.STIME,
C1200_0_CUM_NEIGH - C1204_1_CUM_NEIGH + C1205_0_CUM_NEIGH as 今天的测试公式,
C1202_0_CUM_NEIGH * C1205_0_CUM_NEIGH / C1205_1_CUM_NEIGH - C1204_1_CUM_NEIGH as 6月10号测试   
from AOFS_ADJ  ,AOFS_BSC  
where 
AOFS_ADJ .name = AOFS_BSC .name 
and 
AOFS_ADJ .STIME= AOFS_BSC .STIME)

你可能感兴趣的:(SQL错误,1327)