Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
392 views
in Technique[技术] by (71.8m points)

查找出某日,成交金额最大的股票的基本情况

目标数据库中数据表的结构:

describe  stock.quote;
+--------+-----------------+------+-----+---------+----------------+
| Field  | Type            | Null | Key | Default | Extra          |
+--------+-----------------+------+-----+---------+----------------+
| id     | int(8) unsigned | NO   | PRI | NULL    | auto_increment |
| code   | text            | YES  |     | NULL    |                |
| date   | date            | YES  |     | NULL    |                |
| open   | double          | YES  |     | NULL    |                |
| high   | double          | YES  |     | NULL    |                |
| low    | double          | YES  |     | NULL    |                |
| close  | double          | YES  |     | NULL    |                |
| volume | bigint(20)      | YES  |     | NULL    |                |
+--------+-----------------+------+-----+---------+----------------+

查找出2020-08-24日,成交量最大的股票的基本情况
use stock;
select * from quote where volume=(select max(volume) from quote where date='2020-08-24');

现在我的问题是,查找出2020-08-24日,成交金额最大的股票的基本情况,这个sql如何写?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

1 Answer

0 votes
by (71.8m points)
select * from quote where date='2020-08-24' order by volume desc limit 1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
...