Home > Database > Mysql Tutorial > body text

浅析一个MYSQL语法(在查询中使用count)的兼容性问题_MySQL

WBOY
Release: 2016-06-01 13:25:15
Original
939 people have browsed it

bitsCN.com 简单来说就是在查询中使用count以及更多字段

select count(id),id,name from table 

很尴尬的,我的环境是5.5的,这个是能获取到结果的,但是运行到服务器就不行了
好吧,报了一个错误

#1140 - Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause  

在5.x是可以用的,不过其它字段的值只是获取到第一条的信息,好吧,我承认这是一个偏门的写法,无实际意义,可能是新手的一个语法结构思路不清晰所致。
好吧,作为一个新人,我还是明智的使用WAMP的版本切换功能切换过去吧bitsCN.com

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!