如果question_id匹配,我尝试获取B1的总和和answer_value的总和。如何在我的mysql查询中添加连接?
question <- table
question_id B1
1 1
2 1
3 1
answers <-table
question_id answer_value
1 2
2 2
3 2
代码:
select SUM(B1) from questions where B1=1
desierd results:
answer_value B1
6 3