简体   繁体   中英

Joining tables with different column name but same value in sqlite

I'm using SQLite to work with my database

I have two different tables, with key columns that have different names but the same value.

As such:

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


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

I need

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

I've been searching, and trying to understand the tutorials to no avail. I guess im just too stupid

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM