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;     

There is no OVER clause in MySQL that I know of, but here is a link that might assist you to accomplish the same results:

http://explainextended.com/2009/03/10/analytic-functions-first_value-last_value-lead-lag/

Hope this helps.


MySQL does not currently support window functions, so over() will only yield syntax errors (or garbage, if it's accepted regardless).