Tag Archives: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column

MySQL Error: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column

Enter the following codes in MYSQL:

set sql_mode=‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION’;

Note:

if you use copy and paste, please delete the two single quotation marks and type them again, otherwise an error will be reported
if you enter them manually, there is no problem at all