我有三个实体: Cue(id, name) Reaction(id, name) Freqs(id, cue_id FK, reaction_id FK, some_other_data)
我想计算(cue,reaction)对的数量,比如(cue.name,reaction.name,count)我已经写了一个查询
SELECT
a.cue_id,
a.reaction_id,
Count(*) as freq
FROM
rdb_freqs a
JOIN rdb_reaction b ON a.cue_id=b.id
JOIN rdb_cue c ON a.reaction_id=c.id
GROUP BY a.cue_id, a.reaction_id
ORDER BY freq DESC;
但是我应该如何用'name'替换'id'?