我正在开设一个包含投注竞赛的网站
我想要做的是在本月从名为match
的表中选择TOP 10球员这是mysql表的照片
我需要mysql查询,SELECT SUM(moguci_dobitak)FROM匹配仅当rezultat ='win'且日期是当前月份和当前年份GROUPED BY用户
翻译
moguci_dobitak =利润
rezultat =结果
感谢。
答案 0 :(得分:1)
尝试类似:
SELECT SUM(moguci_dobitak)
FROM matches
WHERE rezultat='win' AND MONTH(date) = MONTH(NOW())
GROUP BY user
答案 1 :(得分:0)
SELECT TOP 2 * FROM匹配其中rezultat ='win'和DATE_SUB(CURDATE(),INTERVAL 30 DAY)< = date_col group by User;
答案 2 :(得分:0)
SELECT SUM(moguci_dobitak)
FROM matches
WHERE rezultat='win'
AND MONTH(date) = MONTH(NOW())
AND YEAR(date) = YEAR(NOW())
GROUP BY user