SELECT user_id, SUM(score) FROM betquiz.quiz_users
WHERE date_submitted BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()
and
score=1
or
score=2
GROUP BY user_id;
SELECT user_id, SUM(score) FROM betquiz.quiz_users
WHERE date_submitted BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()
and
score=3
GROUP BY user_id;
SELECT userid, count(userid) FROM orders
WHERE stamp BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()
and
status='filled'
GROUP BY userid;
SELECT user_id, SUM(score) FROM betquiz.quiz_users
WHERE date_submitted BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()
GROUP BY user_id;
SELECT instr, SUM(qty) FROM orders
WHERE stamp BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()
and
status='filled'
GROUP BY instr;
#OTP pl
SELECT * FROM `orders` WHERE `instr` = 'otp' AND `status` = 'filled' AND `stamp` >= '2017-02-27 09:03:00' ORDER BY `stamp` DESC
#darabonként
select instr, sum(qty) as total
from orders
WHERE stamp BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()
GROUP BY instr, qty
order by qty DESC;
SELECT userid, count(userid) FROM orders
WHERE stamp BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()
and
status='filled'
GROUP BY userid;
SELECT instr, SUM(qty*execprice+fee) FROM orders
WHERE `stamp` >= '2017-02-27 09:03:00'
#vagy
#WHERE stamp BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()
and
status='filled'
GROUP BY instr;