Asghar Nazir
Asghar Nazir

Reputation: 369

Error while executing MySQL queries on MySQL server version 8

I am trying to execute a query on MySQL server but it is throwing below errors. It was working fine on MySQL server 5.1 but now I am using 8.0

Query

SELECT group1s.group_id, group1s.customer_id
 FROM icm_b_instance_group1s as group1s inner join icm_b_instance_groups 
as groups on group1s.group_id = groups.group_id
 where group1s.is_active = 'Y' and groups.is_active = 'Y';

[Code: 1064, SQL State: 42000] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups on group1s.group_id = groups.group_id' at line 2

Upvotes: 0

Views: 188

Answers (1)

forpas
forpas

Reputation: 164099

From MySQL 8.0 Keywords and Reserved Words

GROUPS (R); added in 8.0.2 (reserved)

So groups which you use as an alias is a reserved word and cannot be used in versions 8.0.2+

Upvotes: 1

Related Questions