我有这种情况:
select AVG(t_vote.rating) as AVG_1 from t_vote
INNER JOIN t_question.c_question = t_vote.c_question
where t_question.aspect_code = 'A';
select AVG(t_vote.rating) as AVG_2 from t_vote
INNER JOIN t_question.c_question = t_vote.c_question
where t_question.aspect_code = 'B';
select AVG(t_vote.rating) as AVG_3 from t_vote
INNER JOIN t_question.c_question = t_vote.c_question
where t_question.aspect_code = 'C';
有没有可能在一个查询中用3个不同的where子句得到这3个不同的值?
这是我的table结构,如果我弄错了table,请纠正我
我把这个表作为一个例子,但我的表实际上看起来像这个表的例子
1条答案
按热度按时间shstlldc1#
可以使用条件聚合: