当我运行一条联合查询的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的更多相关文章

  1. [Err] 1248 - Every derived table must have its own alias

    问题描述 [Err] 1248 - Every derived table must have its own alias 问题原因 这句话的意思是说每个派生出来的表都必须有一个自己的别名 我的Mys ...

  2. MySql 1248 - Every derived table must have its own alias

    执行一个sql语句,报错:1248 - Every derived table must have its own alias 提示说每一个衍生出来的表,必须要有自己的别名 执行子查询的时候,外层查询 ...

  3. (转载)1248 - Every derived table must have its own alias

    (转载)http://hi.baidu.com/lylegend13/item/a79f17eb51f5dff7e0a5d43b 1. select count(distinct CName) fro ...

  4. 错误代码: 1248 Every derived table must have its own alias

    1.错误描述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:SELECT stu_id, (SELECT stu_name FROM t ...

  5. 【MYSQL】MYSQL报错解决方法: Warning: (3719, "'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8M B4 in a future release."

    用python3.6.5创建mysql库时出现如下报错,虽然报错,但是数据库可以插入成功. D:\python3\lib\site-packages\pymysql\cursors.py:170: W ...

  6. MySQL 报错

    SELECT COUNT(1) FROM (select tid from teacher where tname like '李%') 1248 - Every derived table must ...

  7. Every derived table must have its own alias

    完整错误信息如下: Every derived table must have its own alias 三月 28, 2017 10:20:46 上午 org.apache.catalina.co ...

  8. mysql执行update报错 Err] 1055 - 'information_schema.PROFILING.SEQ' isn't in GROUP BY

    mysql执行update报错 Err] 1055 - 'information_schema.PROFILING.SEQ' isn't in GROUP BY 今天开发的同事发来如下错误信息,最最简 ...

  9. sql查询报错:Every derived table must have its own alias

    执行sql语句出现语法错误 Every derived table must have its own alias 翻译:每个派生表都有自己的别名

随机推荐

  1. Shell脚本监控CPU、内存和硬盘利用率

    1.监控CPU利用率(通过vmstat工具) #!/bin/bash #==================================================== # Author: l ...

  2. Configuration on demand is not supported by the current version of the Android Gradle plugin since you are using Gradle version 4.6 or above. Suggestion: disable configuration on demand by setting org

    androidStudio打开cocos3.17.2Lua项目时,出现了 Configuration on demand is not supported by the current version ...

  3. source insight搭建python环境

    SI是一个受到广泛欢迎的代码阅读/编辑器,那么能不能用SI来进行python开发呢,经过一晚上的试验,终于实现了这一功能. 1.python的语法高亮 source insight 4.0版本已经默认 ...

  4. leetcode-數組篇

    Remove Element public class Lc27 { public static int removeElement(int[] nums, int val) { if (nums = ...

  5. IT兄弟连 HTML5教程 HTML5表单 新增的表单属性2

    5  height和width属性 height和width属性规定用于image类型和input标签的图像高度和宽度.图像通常会同时指定高度和宽度属性.如果图像设置高度和宽度,图像所需的空间在加载页 ...

  6. 六、SQL优化

    SQL优化 优化策略 一.尽量全值匹配 当建立了索引列后,尽量在where条件中使用所有的索引. CREATE TABLE `staffs`( id int primary key auto_incr ...

  7. Wpf Dispatcher.BeginInvoke((Action)delegate{}));

    <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/w ...

  8. ASP.NET MVC IOC依赖注入之Autofac系列(一)- MVC当中应用

    话不多说,直入主题看我们的解决方案结构: 分别对上面的工程进行简单的说明: 1.TianYa.DotNetShare.Model:为demo的实体层 2.TianYa.DotNetShare.Repo ...

  9. C#如何判断委托是实例方法还是静态方法

    一. 委托的分类 通过用什么类型的方法来声明为委托,可以分为两类: 1. 委托静态方法:把一个静态方法给委托 2. 委托实例方法:把一个实例对象的成员方法给委托 (这两个名字是博主取的,可能不是很专业 ...

  10. 首个企业架构TOGAF角色扮演案例培训的诞生

    BangEA企业架构系列在不同机构做了不少TOGAF认证课,自己都觉得有点枯燥了,我在想我们IT帮2020年第一期的认证课是不是该换种授课方式呢?想到就做......TOGAF认证培训,最早主要就是讲 ...