在sqlite中连接具有不同列名但值相同的表

时间:2015-02-11 14:31:15

标签: sql sqlite

我正在使用SQLite来处理我的数据库

我有两个不同的表,其中键列具有不同的名称但值相同。

因此:

shoes
Identification | Name | Shoe size
1                Bob       10
2                John      12


payment
PaymentID | Price | Year
1            20     2013
2            38     2015

我需要

Identification(or PaymentID, no matter) | Name | Shoe size | Price | Year
1                                          Bob       10        20   2013
2                                          John      12        38   2015

我一直在寻找,并试图理解这些教程无济于事。我想我太傻了

1 个答案:

答案 0 :(得分:4)

select s.identification, s.name, s.`shoe size`, p.price, p.year
from shoes s
join payment p on p.paymentid = s.identification
相关问题