我的SQLite数据库中有两个表,如下所示
表A:
| Id | Date | Rate | Person
|:-- |:-------:| ----:| ------:|
| 1 | 2022-02 | 6.3 | Alex |
| 1 | 2022-05 | 4.2 | John |
| 2 | 2022-09 | 2.5 | Alex |
| 3 | 2022-01 | 7.8 | David |
| 2 | 2022-21 | 9 | William|
表B:
| Id | City | Country |
|:-- |:---------:| -------:|
| 1 | London | England |
| 2 | Paris | France |
| 3 | Washington| USA |
| 4 | Berlin | Germany |
我需要一个查询,以获得ID和利率的每一行,在表A中,然后获得国家的ID在表B中的结果应该是这样的表C:
| Ids | Countries | Rates |
|:--- |:---------:| -----:|
| 1 | England | 6.3 |
| 1 | England | 4.2 |
| 2 | France | 2.5 |
| 3 | USA | 7.8 |
| 2 | France | 9 |
1条答案
按热度按时间jljoyd4f1#
您需要将
A
和B
与Id
连接起来,并选择一些列: