相关文章推荐
博学的枇杷  ·  SQL中的嵌套CASE语句 - ·  2 月前    · 
唠叨的硬盘  ·  如何实现MySQL case when ...·  2 月前    · 
微笑的青蛙  ·  selenium ...·  2 月前    · 
帅呆的篮球  ·  子查詢 (SQL Server) - ...·  2 月前    · 
豪爽的热水瓶  ·  How to export a Hive ...·  1 月前    · 
英俊的针织衫  ·  商水县:引来活水深培训,多措并举育师魂_周口 ...·  1 年前    · 
慷慨大方的麻辣香锅  ·  明太祖朱元璋有26个儿子,他们分别是谁呢?结 ...·  1 年前    · 
文质彬彬的凉面  ·  TS 下uint8array 转 ...·  1 年前    · 
会搭讪的石榴  ·  80年代珠影厂7朵金花,再回首容颜不再,她们 ...·  1 年前    · 
博学的汤圆  ·  姐姐露脸了👴🏻爷青结,还我的《玩偶姐姐》 ...·  1 年前    · 
Code  ›  MySQL :: MySQL 8.0 Reference Manual :: 13.2.15.10 Subquery Errors
mysql select
https://dev.mysql.com/doc/refman/8.0/en/subquery-errors.html
礼貌的高山
2 年前
Statements That Cause an Implicit Commit
SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements
LOCK INSTANCE FOR BACKUP and UNLOCK INSTANCE Statements
LOCK TABLES and UNLOCK TABLES Statements
SET TRANSACTION Statement
XA Transactions
XA Transaction SQL Statements
XA Transaction States
Restrictions on XA Transactions
CREATE FUNCTION Statement for Loadable Functions
DROP FUNCTION Statement for Loadable Functions
INSTALL COMPONENT Statement
INSTALL PLUGIN Statement
UNINSTALL COMPONENT Statement
UNINSTALL PLUGIN Statement

ERROR 1235 (ER_NOT_SUPPORTED_YET)
SQLSTATE = 42000
Message = "This version of MySQL doesn't yet support
'LIMIT & IN/ALL/ANY/SOME subquery'"

This means that MySQL does not support statements like the following:

SELECT * FROM t1 WHERE s1 IN (SELECT s2 FROM t2 ORDER BY s1 LIMIT 1)
  • Incorrect number of columns from subquery:

    ERROR 1241 (ER_OPERAND_COL)
    SQLSTATE = 21000
    Message = "Operand should contain 1 column(s)"

    This error occurs in cases like this:

    SELECT (SELECT column1, column2 FROM t2) FROM t1;

    You may use a subquery that returns multiple columns, if the purpose is row comparison. In other contexts, the subquery must be a scalar operand. See Section 13.2.15.5, “Row Subqueries” . Incorrect number of rows from subquery:

    ERROR 1242 (ER_SUBSELECT_NO_1_ROW)
    SQLSTATE = 21000
    Message = "Subquery returns more than 1 row"

    This error occurs for statements where the subquery must return at most one row but returns multiple rows. Consider the following example:

    SELECT * FROM t1 WHERE column1 = (SELECT column1 FROM t2);

    If SELECT column1 FROM t2 returns just one row, the previous query works. If the subquery returns more than one row, error 1242 occurs. In that case, the query should be rewritten as:

    SELECT * FROM t1 WHERE column1 = ANY (SELECT column1 FROM t2);
  • Incorrectly used table in subquery:

    Error 1093 (ER_UPDATE_TABLE_USED)
    SQLSTATE = HY000
    Message = "You can't specify target table 'x'
    for update in FROM clause"

    This error occurs in cases such as the following, which attempts to modify a table and select from the same table in the subquery:

    UPDATE t1 SET column2 = (SELECT MAX(column1) FROM t1);

    You can use a common table expression or derived table to work around this. See Section 13.2.15.12, “Restrictions on Subqueries” . In MySQL 8.0.19 and later, all of the errors described in this section also apply when using TABLE in subqueries. For transactional storage engines, the failure of a subquery causes the entire statement to fail. For nontransactional storage engines, data modifications made before the error was encountered are preserved.

  •  
    推荐文章
    博学的枇杷  ·  SQL中的嵌套CASE语句 -
    2 月前
    唠叨的硬盘  ·  如何实现MySQL case when 套用子查询的具体操作步骤_mob649e81540090的技术博客_
    2 月前
    微笑的青蛙  ·  selenium 难定位元素,时间插件,下拉框定位,string - konglingbin
    2 月前
    帅呆的篮球  ·  子查詢 (SQL Server) - SQL Server | Microsoft Learn
    2 月前
    豪爽的热水瓶  ·  How to export a Hive table into a CSV file? - Stack Overflow
    1 月前
    英俊的针织衫  ·  商水县:引来活水深培训,多措并举育师魂_周口市教育体育局
    1 年前
    慷慨大方的麻辣香锅  ·  明太祖朱元璋有26个儿子,他们分别是谁呢?结局又怎么样呢?_三子_长子_生母
    1 年前
    文质彬彬的凉面  ·  TS 下uint8array 转 buffer - CSDN文库
    1 年前
    会搭讪的石榴  ·  80年代珠影厂7朵金花,再回首容颜不再,她们的生活现状如何了?_梁玉瑾_电影_表演
    1 年前
    博学的汤圆  ·  姐姐露脸了👴🏻爷青结,还我的《玩偶姐姐》😭_哔哩哔哩_bilibili
    1 年前
    今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
    删除内容请联系邮箱 2879853325@qq.com
    Code - 代码工具平台
    © 2024 ~ 沪ICP备11025650号