A
A
aidos_sh2021-06-09 10:25:47
SQL
aidos_sh, 2021-06-09 10:25:47

How to make a request to display the current price on the date of sale of a product from another table?

There are two tables. In one products and changes by product, including prices. In another table selling products. I sort of did the first task, but I would like to hear the opinion and the correctness of the request. The second task I can not master at all. I can't link two tables so that I can take the actual price for the date
Used DBMS Oracle 11g.
Write queries to display:
1. Current subscription parameters as of 01-11-2020.
2. Total income from sales in the channel 1.
60c0618c36245936715768.png
60c0728ea2a01582100053.png
Select
Write queries to display:
1. Current subscription parameters as of 01-11-2020. Output subscription_code, name, price
2. Total revenue from sales in the channel 1.

Solution:
1. Select subscription_code, name, price
from table1
right join (Select subscription_code, max(update_date) as actual_date
Where update_date<=01-11-2020
Group by subscription code) as a
on table1. subscription_code=a. subscription_code and table1. update_date=a. actual_date

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question