假设有2个表中的SQL Server数据库:SQL查询:乘法从2个表
table1
,这里的产品价格都存储在价格的变化:
|Date |Product|Price|
--------------------------
|2014-01-01| A | 2$|
|2015-01-01| A | 3$|
table2
,其中数量销售的产品是按日期存储:
|Date | Product | Quantities|
-----------------------------------
|2014-01-01 | A | 200 |
|2014-06-01 | A | 300 |
|2015-02-01 | A | 100 |
我的问题:如何通过编写一个SQL查询来计算销售(股价×数量)的日期产品:
|Date | Product | Sales |
---------------------------------
|2014-01-01 | A | 400 |
|2014-06-01 | A | 600 |
|2015-02-01 | A | 300 |
你尝试过什么,到底是什么?这并不困难,并且涉及SQL中最基本的操作符之一。 – 2015-02-24 19:53:35