当我运行一条联合查询的sql语句时报如下错误:

[Err] 1248 - Every derived table must have its own alias,大概意思是每一张派生表必须要有自己的别名。这里加上别名即可。

原先sql:

 

select * from t_test t1 where t1.content like '%test%'
Union all
select * from 
(select * from t_test t2 where t2.content not like '%test%' order by t2.content asc);

 

加上别名之后:

select * from t_test t1 where t1.content like '%test%'
Union all
select * from 
(select * from t_test t2 where t2.content not like '%test%' order by t2.content asc) d;

再运行一遍之后问题解决

【mysql报错】[Err] 1248 - Every derived table must have its own alias

 

相关文章:

  • 2021-06-11
  • 2022-12-23
  • 2021-12-26
  • 2022-02-09
  • 2021-05-26
  • 2021-09-08
  • 2022-12-23
猜你喜欢
  • 2021-10-29
  • 2022-12-23
  • 2022-03-03
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2021-11-18
相关资源
相似解决方案