我有2個表,現在和他們如下所示:如何根據多條記錄選擇多列與MySQL?
的points
表如下所示:
id country points
1 4 1
2 7 5
3 8 4
的sample
表如下所示:
id iso pts
1 UK 100
2 US 300
3 AU 700
4 BO 1200
5 BA 1500
6 BR 2000
7 HR 5000
8 TD 10000
9 CA 15000
什麼我基本上想要的是從points
表中選擇所有數據,其中points.country
和points.points
對應於sample.iso
和sample.pts
。
所以我想達到的效果是:
id country points
1 BO 100
2 HR 1500
3 TD 1200
這是真正實現?如果是,如何?
你的樣品結果不符合您的樣本數據。 – FreeAsInBeer
** @ FreeAsInBeer **,它確實。 'country'和'points'字段是'sample'表的外鍵。 – Linger
這是一個非常奇怪的請求,雖然 – Strawberry