`
woshixushigang
  • 浏览: 575969 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类

sql Column 'id' in order clause is ambiguous

 
阅读更多

编写数据库查询语句时候报错,发现语句正确啊.

 

 

select j.date,m.daily_id, m.meeting_time,m.next_meeting_time,m.result,m.recommend_insurance,m.credit,m.premium from bb_app.journal_daily_meeting as m inner join bb_app.journal_daily as j on m.daily_id=j.id  where m.cid=:cid  and m.status & 0 = 0 order by id desc  limit 0,20

 程序执行就会报错。改成下面就不会报错。

 

select j.id,j.date,m.daily_id, m.meeting_time,m.next_meeting_time,m.result,m.recommend_insurance,m.credit,m.premium from bb_app.journal_daily_meeting as m inner join bb_app.journal_daily as j on m.daily_id=j.id  where m.cid=:cid  and m.status & 0 = 0 order by id desc  limit 0,20

 不是很理解。

分享到:
评论

相关推荐

    MySQL异常:[Err] 1055 – Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nona…

    在MySQL中,错误提示 "[Err] 1055 – Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column…” 指的是在执行包含`GROUP BY`子句的查询时,你试图对未在`GROUP BY`子句中...

    MySQL5.7中的sql_mode默认值带来的坑及解决方法

    在正常项目开发过程中,如果MySQL版本从5.6升级到5.7版本。作为DBA在考虑数据库版本升级带来的影响时,一般会有几个注意点...ERROR 1055 (42000): Expression #3 of XXXXXX list is not in GROUP BY clause and contain

    微软内部资料-SQL性能优化5

    The order of pages in the page chain, and the order of rows on the data pages, is the order of the index key or keys. Deciding which key to cluster on is an important performance consideration. When ...

    mysql中You can’t specify target table for update in FROM clause错误解决方法

    在MySQL数据库中,"You can’t specify target table for update in FROM clause"是一个常见的错误提示,意味着在同一个SQL语句中,你不能直接在一个`UPDATE`或`DELETE`语句的`FROM`子句中引用你想要更新或删除的表...

    mysql遇到Expression.docx

    在MySQL中,当你尝试执行一个包含`GROUP BY`子句的查询时,可能会遇到"Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column"这样的错误。这个错误提示表明你的查询违反了`...

    SAS.9.2.SQL.Procedure.Users.Guide

    The SQL procedure in SAS (Statistical Analysis System) is a powerful tool that enables users to execute SQL statements within the SAS environment. This procedure provides an interface between SAS and ...

    解决MySQL 5.7.9版本sql_mode=only_full_group_by问题

    Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘col_user_6.a.START_TIME’ which is not functionally dependent on columns in GROUP BY clause; this is ...

    mysql中You can’t specify target table for update in FROM clause错误解决方法.docx

    在MySQL数据库管理过程中,遇到SQL语法错误是家常便饭,其中一种较为常见的错误是“You can’t specify target table for update in FROM clause”。这种错误通常发生在执行UPDATE语句时,涉及到表自连接或者在FROM...

    ORACLE和SQL Server的语法区别

    - **SQL Server:** SQL Server也有自己的内置函数集,如`ISNULL()`、`CONVERT()`、`FLOOR()`等。 - **转换策略:** - 用相应的SQL Server函数替代Oracle函数。 #### 五、字符串连接 - **Oracle:** Oracle使用`||...

    SQLPrompt_7.3.0.651(包含注册机)

    Support ticket 76423: ambiguous columns are now always qualified with their table/alias inside an ORDER BY clause 7.3.0.642 - 27th October Support for user account licensing (More info) 7.3.0.639 - ...

    Oracle和SqlServer语法区别

    CREATE OR REPLACE FUNCTION get_employee_name(p_employee_id IN NUMBER) RETURN VARCHAR2 IS v_employee_name VARCHAR2(100); BEGIN SELECT name INTO v_employee_name FROM employees WHERE employee_id = p...

    UNIDAC 6.4.16 XE8

    Bug with WITH clause in TUniScript is fixed Bug with inserting identity fields through TUniLoader in the Direct mode is fixed Bug with updating a field containing a space in an alias in the Direct ...

    SQLPrompt_7.3.0.564

    Column names in temp tables using quoted identifiers are now suggested Inline EXEC now correctly handles parameters using the DEFAULT value Fix for incorrect indentation when using UNION Fix for ...

    《Pro Oracle SQL》CHAPTER 9 The Model Clause -- 9.5 Evaluation Order

    《Pro Oracle SQL》一书的第9章深入探讨了Oracle数据库中的“Model”子句,这一章节重点关注了9.5节——评估顺序。在Oracle SQL中,Model子句是一种高级的行处理工具,用于进行复杂的行计算和模拟迭代过程,比如解决...

    oracle advanced sql 高级SQL教程 ORACLE官方教材

    Using a Subquery in the FROM Clause 4-10 Scalar Subquery Expressions 4-11 Scalar Subqueries: Examples 4-12 Correlated Subqueries 4-14 Using Correlated Subqueries 4-16 Using the EXISTS Operator 4-18 ...

    Pro Oracle SQL

    You’ll also understand how SQL is optimized for working in sets, and that the key to getting accurate results lies in making sure that queries ask clear and precise questions., , What’s the bottom-...

    SqlServer:使用IN()子句C#进行参数化查询

    文件名中的"SqlServer-Parameterized-Query-With-IN-Clause-Cshar.pdf"可能是详细解释这一主题的文档,而"LogOn.aspx?rp=%2FKB%2Fdatabase%2F1276827%2FInClauseParam.zip&download=true"则可能指向一个包含更多示例...

    mysql中错误:1093-You can’t specify target table for update in FROM clause的解决方法

    在MySQL中,错误1093 - "You can't specify target table for update in FROM clause" 是一个常见的问题,它发生在尝试在`UPDATE`语句的`FROM`子句中直接引用要更新的同一张表时。这个错误表示MySQL不支持在`UPDATE`...

    unidac64src 6.4.15

    Bug with QueryRecCount when ORDER clause contains CASE..END is fixed Bug with processing parameters on setting of an SQL query is fixed Oracle data provider Bug with using DATEADD function in ...

Global site tag (gtag.js) - Google Analytics