SELECT list is not in GROUP BY clause and contains nonaggregated column …. incompatible with sql_mode=only_full_group_by

AM using MySQL 5.7.13 on my windows PC with WAMP Server Here my Problem is While executing this query SELECT * FROM `tbl_customer_pod_uploads` WHERE `load_id` = ’78’ AND `status` = ‘Active’ GROUP BY `proof_type` Am getting always error like this Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column … Read more

What’s faster, SELECT DISTINCT or GROUP BY in MySQL?

If I have a table CREATE TABLE users ( id int(10) unsigned NOT NULL auto_increment, name varchar(255) NOT NULL, profession varchar(255) NOT NULL, employer varchar(255) NOT NULL, PRIMARY KEY (id) ) and I want to get all unique values of profession field, what would be faster (or recommended): SELECT DISTINCT u.profession FROM users u or … Read more

Count unique values per groups with Pandas [duplicate]

This question already has answers here: Pandas ‘count(distinct)’ equivalent (10 answers) Closed 3 years ago. I need to count unique ID values in every domain. I have data: ID, domain 123, ‘vk.com’ 123, ‘vk.com’ 123, ‘twitter.com’ 456, ‘vk.com’ 456, ‘facebook.com’ 456, ‘vk.com’ 456, ‘google.com’ 789, ‘twitter.com’ 789, ‘vk.com’ I try df.groupby([‘domain’, ‘ID’]).count() But I want … Read more

Reason for Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause [duplicate]

This question already has answers here: GROUP BY / aggregate function confusion in SQL (5 answers) Closed 2 years ago. I got an error – Column ‘Employee.EmpID’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. select loc.LocationID, emp.EmpID from Employee as emp … Read more

How do I Pandas group-by to get sum?

I am using this data frame: Fruit Date Name Number Apples 10/6/2016 Bob 7 Apples 10/6/2016 Bob 8 Apples 10/6/2016 Mike 9 Apples 10/7/2016 Steve 10 Apples 10/7/2016 Bob 1 Oranges 10/7/2016 Bob 2 Oranges 10/6/2016 Tom 15 Oranges 10/6/2016 Mike 57 Oranges 10/6/2016 Bob 65 Oranges 10/7/2016 Tony 1 Grapes 10/7/2016 Bob 1 Grapes … Read more