Home mysql Help with an error in MySQL request

Help with an error in MySQL request

Author

Date

Category

There is a request:

select
  `T0`. `Name`,` T0.`img_id` as 'id'
From.
  `Store_Product` AS` T0`
Whater
  `T0.`oid` =: OID
Group by `T0.`img_id`

The consequence is an error in which I can not figure out:

PDOSTATEMENT :: EXECUTE (): SQLSTATE [42000]: Syntax Error or Access Violation: 1055 Expression # 1 of Select List Is Not in Group by Clause and Contains nonaggregated column ‘db_store5.t0.name’ Which is not functionally dependent on columns in group by clause; This is incompatible with sql_mode = only_full_group_by in …

If you remove the GROUP BY statement, then everything works …


Answer 1, Authority 100%

You have installed sql_mode = only_full_group_by, so if you use GROUP BY, then it is necessary to add all the non-implemented sample fields.

you need to reset SQL_MODE

before executing a selection

set sql_mode = ''
Previous articleSplit Method in Python
Next articleNGINX + Java

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions