MySql对over子句使用正确的语法 [英] MySql using correct syntax for the over clause
本文介绍了MySql对over子句使用正确的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使over子句在mysql中工作的正确语法是什么?
What is the correct syntax to get the over clause to work in mysql?
我想查看每个用户发送的短信总数,而不用group by子句将其分组.
I would like to see the total sms's sent by each user without grouping it with the group by clause.
SELECT
username,
count(sentSmsId) OVER (userId)
FROM
sentSmsTable,
userTable
WHERE
userId = sentUserId;
推荐答案
我不知道MySQL中没有OVER子句,但这是一个可以帮助您实现相同结果的链接:
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/
希望这会有所帮助.
这篇关于MySql对over子句使用正确的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文