MySql using correct syntax for the over clause

MySQL 8 has got the window functions! Therefore, you can write your query in it like this:

SELECT username, 
       count(sentSmsId) OVER (partition by userId) 
FROM sentSmsTable
JOIN userTable ON userId = sentUserId;     

Leave a Comment