I'd like to make a query that returns just one row when it meets 3 conditions. I have a database that looks like this:
Location | Date | Item | Price |
---|---|---|---|
Chicago | 2021-06-10 | 1 | 150 |
New York | 2021-06-10 | 2 | 130 |
Chicago | 2021-06-10 | 1 | 150 |
Los Angeles | 2021-06-10 | 3 | 100 |
Atlanta | 2021-06-10 | 4 | 120 |
New York | 2021-06-09 | 2 | 125 |
Chicago | 2021-06-09 | 1 | 155 |
Los Angeles | 2021-06-09 | 3 | 99 |
Atlanta | 2021-06-09 | 4 | 140 |
This database contains the price of different items, by date and location. This price changes each day and the price in each location for the same item does not need to be the same. Given that this database contains each sale made in a day, for each item, I'd like to make a query that returns only one observation by Location, Date and Item. I want to have like a time series for each the price of each item, in each location. So the resulting table should look like this:
Location | Date | Item | Price |
---|---|---|---|
Chicago | 2021-06-10 | 1 | 150 |
New York | 2021-06-10 | 2 | 130 |
Los Angeles | 2021-06-10 | 3 | 100 |
Atlanta | 2021-06-10 | 4 | 120 |
New York | 2021-06-09 | 2 | 125 |
Chicago | 2021-06-09 | 1 | 155 |
Los Angeles | 2021-06-09 | 3 | 99 |
Atlanta | 2021-06-09 | 4 | 140 |
Hope someone can help me, thanks.
Aucun commentaire:
Enregistrer un commentaire