Every derived table must have its own alias

这句话的意思是说每个派生出来的表都必须有一个自己的别名

一般在多表查询时,会出现此错误。

因为,进行嵌套查询的时候子查询出来的的结果是作为一个派生表来进行上一级的查询的,所以子查询的结果必须要有一个别名

把MySQL语句改成:select count(*) from (select * from ……) as total;

问题就解决了,虽然只加了一个没有任何作用的别名total,但这个别名是必须的。

如:

select * from (select * from (select * from user))

报错,改成:

SELECT * FROM (
SELECT * FROM (
SELECT * FROM tbl_user
) AS b
) AS c

就ok了。

mysql出现错误“ Every derived table must have its own alias”的更多相关文章

  1. 【MySQL】mysql出现错误“ Every derived table must have its own alias”

    Every derived table must have its own alias 这句话的意思是说每个派生出来的表都必须有一个自己的别名 一般在多表查询时,会出现此错误. 因为,进行嵌套查询的时 ...

  2. MySQL错误:Every derived table must have its own alias

    Every derived table must have its own alias 派生表都必须有自己的别名 一般在多表查询时,会出现此错误. 因为,进行嵌套查询的时候子查询出来的的结果是作为一个 ...

  3. mysql—mysql错误Every derived table must have its own alias解决

    Every derived table must have its own alias 这句话的意思是说每个派生出来的表都必须有一个自己的别名. 一般在多表查询时,会出现此错误. 因为,进行嵌套查询的 ...

  4. mysql错误:“ Every derived table must have its own alias”(每个派生出来的表都必须有一个自己的别名)

    自我感悟: 由此可以延伸,我们得到一个结果集,可以通过as XXX的方式,把结果集给当作一张表来用,以实现子查询: 一般在多表查询时,会出现此错误. 因为,进行嵌套查询的时候子查询出来的的结果是作为一 ...

  5. mysql union出错: "Every derived table must have its own alias"

    SELECT count(*) from (SELECT province_code as area_id, count(*) from t_cas_rural_selected GROUP BY p ...

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

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

  7. Mysql错误:Every derived table must have its own alias

    Mysql报错:Every derived table must have its own alias    <缺少一个别名> 在子查询中经常会犯的错误 .这个别名其实没啥用途....  ...

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

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

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

    当我运行一条联合查询的sql语句时报如下错误: [Err] 1248 - Every derived table must have its own alias,大概意思是每一张派生表必须要有自己的别 ...

随机推荐

  1. POJ_2488——骑士遍历棋盘,字典序走法

    Description Background The knight is getting bored of seeing the same black and white squares again ...

  2. POJ2761---Feed the dogs (Treap求区间第k大)

    题意 就是求区间第k大,区间 不互相包含. 尝试用treap解决一下 第k大的问题. #include <set> #include <map> #include <cm ...

  3. hdu-1598

    思路: 首先如果想到了Kruskal算法,那么下一步我们可能马上会想:那我们就从头开始写这个算法吧.然后一写就很容易发现一个问题——如果按照正常的Kruskal算法来做,那么start到end的舒适度 ...

  4. CF-Mr. Kitayuta's Colorful Graph

    B. Mr. Kitayuta's Colorful Graph time limit per test 1 second memory limit per test 256 megabytes in ...

  5. 修改oracle服务器所在linux主机名

    1.修改/etc/hosts 2.修改 /etc/sysconfig/network 3.修改oracle的 listener.ora 4.修改 tnsnames.ora  

  6. 数据库版本管理工具Flyway(4.0.3)---介绍(译文)

    Flyway Evolve your Database Schema easily and reliably across all your instances 简单的.可靠的升级(发展)你的数据库模 ...

  7. phpstorm xdebug调试设置样式

    由于本人比较喜欢白底的phpstorm开发环境,所以XDEBUG断点调试,F8时默认是没有背景色的,phpstorm中的设置方式如下 files -> settings -> Editor ...

  8. (转)How to renew your Apple Push Notification Push SSL Certificate

    转自:https://blog.serverdensity.com/how-to-renew-your-apple-push-notification-push-ssl-certificate/ It ...

  9. 【微信H5支付】微信公众号里H5网页点击调取微信支付

    最近在公众号里开发了下单支付H5网页,需要在H5里调用微信支付界面.开发思路和代码整理如下: todo...

  10. Android Paint之 setXfermode PorterDuffXfermode 讲解

    setXfermodePorterDuffXfermode图层混合模式android图像混合模式AvoidXfermode 尊重原创,欢迎转载,转载请注明: FROM  GA_studio   htt ...