sql http://www.w3resource.com/mysql/date-and-time-functions/mysql-dayofweek-function.php

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql http://www.w3resource.com/mysql/date-and-time-functions/mysql-dayofweek-function.php相关的知识,希望对你有一定的参考价值。

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;
  

以上是关于sql http://www.w3resource.com/mysql/date-and-time-functions/mysql-dayofweek-function.php的主要内容,如果未能解决你的问题,请参考以下文章

sql 2008和sql 2012的区别

sql [sql技巧]一些sql技巧#sql

sql 2008 r2 在sql 2008上兼容么

SQL基础

有大神知道,sql server 中如何批量执行sql语句吗?

pl sql developer怎么执行sql