我想在我的getadvocacy表中選擇某個行,其中id是另一個名爲swimsuit的表中的id。選擇表中的行,其中id等於另一個表中的另一個id
泳裝表
id | name | average
1 | Abc | 90
3 | Def | 99
getadvocacy
id | all_scores | average_score
1 | 70,70,70 | 70
2 | 70,70,70 | 70
3 | 70,70,70 | 70
現在,我想從getadvocacy選擇,但只有1和3,因爲這是泳裝的數據。
預期輸出
id | all_scores | average_score
1 | 70,70,70 | 70
3 | 70,70,70 | 70
我試過,但它有不同的輸出。
select getadvocacy.id, all_scores, average_score from getadvocacy WHERE getadvocacy.id IN (select id from swimsuit)
你是什麼意思*沒有工作*:你有錯誤嗎?你有不同的結果嗎?你能澄清一下嗎? – trincot
獲得不同的結果。抱歉。我會編輯它。 –
我把你的問題放在小提琴裏,它*會給你想要的輸出:http://sqlfiddle.com/#!9/63069/1。你沒有告訴我們什麼? – trincot