Home > Net >  Cannot find ROW_NUMBER() function in mysql 8.0.17?
Cannot find ROW_NUMBER() function in mysql 8.0.17?

Time:02-14

I setup my web service by using package AppServ : Apache PHP MySQL, which is download from https://www.appserv.org/en/

Mysql version is 8.0.17, and phpMyAdmin is 4.9.1

When I tried to use ROW_NUMBER() function inside phpMyAdmin, it always told me some errors. Eventurally, I feel my Mysql might not include this function.

Is it possible? and how to verify it (mysql hasn't row_number()) and how to solve it?

CodePudding user response:

row is a reserved word in mysql 8.0.2 according to the documentation.

This should work:

SELECT custid, 
email, 
ROW_NUMBER() OVER ( PARTITION BY email ORDER BY email ) AS `row` 
FROM customers;

Or you can ditch row for something non-problematic such as AS rn.

Notice that partitioning by email and ordering by it at the same time doesn't make much sense.

Fiddle

  • Related