Questions tagged [mysql-error-1140]

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

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

13 questions
14
votes
7 answers

MySQL #1140 - Mixing of GROUP columns

Hi wondering if perhaps someone could shed some light on the below error. The sql works fine locally but i get the the below error remotely. SQL query: SELECT COUNT(node.nid), node.nid AS nid, …
frosty
  • 5,330
  • 18
  • 85
  • 122
5
votes
5 answers

MySQL: Include COUNT of SELECT Query Results as a Column (Without Grouping)

I have a simple report sending framework that basically does the following things: It performs a SELECT query, it makes some text-formatted tables based on the results, it sends an e-mail, and it performs an UPDATE query. This system is a…
Hammer Bro.
  • 965
  • 1
  • 10
  • 23
4
votes
1 answer

Zend_Db_Select - Joins and Count - Possible Zend Bug?

I'm having an issue getting a COUNT() from a SQL query using Zend_Db_Table_Select, and I think it may be a possible bug because the SQL it should be generating actually works. Here's the Zend Select Query: ($this is a Zend_Db_Table, renamed to…
Ryan
  • 17,511
  • 23
  • 63
  • 88
3
votes
1 answer

SQL count returns error when no GROUP BY clause

Why I get error with this query on my live server but not on my wamp localhost? SELECT type as type, COUNT(*) AS total FROM page AS p WHERE p.parent_id = p.page_id the error message is, SQLSTATE[42000]: Syntax error or access violation: 1140…
Run
  • 54,938
  • 169
  • 450
  • 748
1
vote
3 answers

MYSQL SELECT DISTINCT with additional column in result set

Here's an example table: CREATE TABLE `deals_unsorted`.`temp_demo` ( `id` INT( 4 ) NOT NULL AUTO_INCREMENT , `price` INT( 5 ) NOT NULL , `name` VARCHAR( 50 ) NOT NULL , PRIMARY KEY ( `id` ) ) ENGINE = MYISAM and some sample data INSERT INTO…
Andy Gee
  • 3,149
  • 2
  • 29
  • 44
1
vote
1 answer

Issues with ORDER BY caused by changing the DATE_FORMAT in the SELECT statement

I'm doing a Databases assignment for Uni and I'm stuck. I'm 99% of the way there. The brief is: Create a query to view the annual sales over the last 12 months of the business showing the total number of products sold and the total price sold every…
iGleeson
  • 13
  • 5
1
vote
1 answer

ONLY_FULL_GROUP_BY not set but still have Error 1140

I am finalizing the implementation of my website but now I have a problem that occurs online that I have not locally. I get this error: failed: Mixing of GROUP columns (MIN (), MAX (), COUNT (), ...) with no GROUP columns is illegal if there is no…
Stevo32
  • 11
  • 1
  • 3
0
votes
0 answers

How to use GROUP BY with LEFT JOIN in MySQL 5.7.5 strict mode

I'm trying to create a query that returns all the images of a user in a categorized fashion, so the response looks like this: { totalAvatarImgs: 6, totalCoverImgs: 2, totalPostImgs: 0, avatarImgs: [{ id: 1, img:…
Csaba
  • 1,945
  • 3
  • 28
  • 46
0
votes
1 answer

MYSQL Group Gy ordering with Count?

I'm trying to do something similar to Select the 3 most recent records where the values of one column are distinct, but with a count, which means I need to preserve the group. Using the same example: id time text …
0
votes
2 answers

MySQL aggregation problems

I'm trying to count how many essays have been graded so I know how many results to display on the page. But I can't seem to get the code to work properly can someone help? Thanks for the help in advance! Here is what I got so far. SELECT students.*,…
labs
  • 47
  • 4
0
votes
2 answers

MySQL aggregation error

I'm trying to count all the ids form table3 that are related to the first two tables but I think my SQL code is wrong can some one help me fix it? Here is the code: $dbc = mysqli_query($mysqli,"SELECT table1.*, table2.*, COUNT(id) as num,…
space
  • 1
  • 1
0
votes
3 answers

Mixing of Group Columns with No Group Columns

I got this error and I'm not sure how to work with it. Simple explanations would be much appreciated. Error: 1140: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause - SELECT email,…
Ed.
  • 1
  • 1
  • 1
0
votes
1 answer

How to get smallest column value without triggering "Mixing of GROUP columns [...] with no GROUP columns is illegal if there is no GROUP BY clause"?

I have a table 'foo' with a timestamp field 'bar'. How do I get only the oldest timestamp for a query like: SELECT foo.bar from foo? I tried doing something like: SELECT MIN(foo.bar) from foo but it failed with this error ERROR 1140 (42000) at line…
amh
  • 690
  • 1
  • 8
  • 19