我想在我的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