S
soul
Unregistered / Unconfirmed
GUEST, unregistred user!
呵呵,简单点说把一或二个月内所有每人笔记的“和当前日期差值换算出的权值”之和的倒排序。
我和wint昨天讨论了3个小时这个逻辑。最后的sql是:
SELECT TOP 18 * FROM (
SELECT author, SUM(43200 - DATEDIFF(mi, createtime, GETDATE())) AS s
FROM idealog WHERE createtime > dateadd(mi, - 43200, getdate())
GROUP BY author) t
ORDER BY s DESC
或者
SELECT top 20 *
FROM (SELECT author, SUM(cos(DATEDIFF(mi, createtime, GETDATE()) / 10000.0))
AS s
FROM idealog
WHERE createtime > dateadd(mi, - 15700, getdate())
GROUP BY author) t
ORDER BY s DESC
我和wint昨天讨论了3个小时这个逻辑。最后的sql是:
SELECT TOP 18 * FROM (
SELECT author, SUM(43200 - DATEDIFF(mi, createtime, GETDATE())) AS s
FROM idealog WHERE createtime > dateadd(mi, - 43200, getdate())
GROUP BY author) t
ORDER BY s DESC
或者
SELECT top 20 *
FROM (SELECT author, SUM(cos(DATEDIFF(mi, createtime, GETDATE()) / 10000.0))
AS s
FROM idealog
WHERE createtime > dateadd(mi, - 15700, getdate())
GROUP BY author) t
ORDER BY s DESC