【发布时间】:2012-02-15 03:21:05
【问题描述】:
所以我要做的是制作一个趋势算法,我需要 SQL 代码方面的帮助,因为我无法让它运行。
算法有三个方面:(我对更好的趋势算法完全持开放态度)
1.Plays during 24h / Total plays of the song
2.Plays during 7d / Total plays of the song
3.Plays during 24h / The value of plays of the most played item over 24h (whatever item leads the play count over 24h)
每个方面的值应为 0.33,最大值为 1.0 是可能的。
第三个方面是必要的,因为新上传的项目会自动排在首位,除非他们可以将它们放下。
该表名为 aud_plays 列是:
PlayID: Just an auto-incrementing ID for the table
AID: The id of the song
IP: ip address of the user listening
time: UNIX time code
我已经尝试了一些 sql 代码,但我非常坚持无法让它工作。
【问题讨论】:
-
很抱歉,您能说得更详细些吗?我只听到算法、.33 和 SQL。
-
当然,我想要一个 SQL 查询来确定哪一首歌与其他歌曲相比更流行。我想到的是三个值,每个值最大值为 0.33。这三个值的总和将被排序以确定趋势最高的歌曲。目前我希望查询的三个 0.33 值由歌曲的 24 小时播放次数/总播放次数、7 天播放次数/歌曲总播放次数和 24 小时播放次数/24 小时播放次数最多的歌曲确定24小时
-
能贴出你试过的SQL代码吗?
标签: php mysql sql algorithm trend