0
我想在最流行的索引頁面上顯示用戶的帖子。用mysql中的數學公式排序
而且我有(喜歡+意見,不喜歡)/(今天的日期,posteddate)計算它
我可以通過數學公式ORDER BY子句中的MySQL?
編輯:
確定這裏是我使用的是現在查詢:
SELECT Posts.PostId, Posts.PostTitle, Posts.TextContent,Posts.PostType, PostedAs, CONCAT(PostedDate,' ',PostedTime) AS Date,
COUNT(PostLikes.PostId) AS Likes, COUNT(PostViews.PostId) AS Views,
(CASE Posts.PostType
WHEN 'media'
THEN (SELECT MediaContent FROM PostsMedia WHERE PostsMedia.PostId = Posts.PostId GROUP BY PostsMedia.PostId)
ELSE
'non-media'
END
) AS MediaContent,
(CASE Posts.PostType
WHEN 'media'
THEN (SELECT MediaType FROM PostsMedia WHERE PostsMedia.PostId = Posts.PostId GROUP BY PostsMedia.PostId)
ELSE
'non-media'
END
) AS MediaType
FROM Posts, PostLikes, PostViews
WHERE Posts.PostId = PostLikes.PostId AND PostLikes.Liked = 1 AND Posts.Classification <> 'sales_related' AND (LOWER(Posts.PostType) != 'text' AND LOWER(Posts.PostType) != 'shout')
AND Posts.Filter<>'HOME' GROUP BY PostLikes.PostId, PostViews.PostId ORDER BY Likes DESC, Views DESC $limitClause
當你給它一個嘗試發生了什麼事? – BWS
老實說,我們沒有majic玻璃...除非你發佈你的代碼,,, – user1844933
@ user1844933:我已經爲你添加了查詢代碼。現在你可以從普通玻璃看到.. –