在sqlite中连接具有不同列名但相同值的表
Joining tables with different column name but same value in 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
我一直在搜索,并试图理解这些教程,但无济于事。我想我太笨了
select s.identification, s.name, s.`shoe size`, p.price, p.year
from shoes s
join payment p on p.paymentid = s.identification
我正在使用 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
我一直在搜索,并试图理解这些教程,但无济于事。我想我太笨了
select s.identification, s.name, s.`shoe size`, p.price, p.year
from shoes s
join payment p on p.paymentid = s.identification