如何使用mysql显示3表中的2值和1值计数
我有三张桌子 表1(理论问题) id | question | mark | technology如何使用mysql显示3表中的2值和1值计数,mysql,Mysql,我有三张桌子 表1(理论问题) id | question | mark | technology 您应该使用适当的on子句来连接表 并将group by触发器用于聚合函数(计数) 这对我有用。。。。。。。。。。 谢谢你 选择问号。问号名称,技术。技术名称,计数(theoryquestion.question),从theoryquestion的theoryquestion内部连接问号中选择theoryquestion上的问号。mark=question\u mark.mark\u名称theory
您应该使用适当的on子句来连接表 并将group by触发器用于聚合函数(计数)
这对我有用。。。。。。。。。。 谢谢你
选择问号。问号名称,技术。技术名称,计数(theoryquestion.question),从theoryquestion的theoryquestion内部连接问号中选择theoryquestion上的问号。mark=question\u mark.mark\u名称theoryquestion上的内部连接技术。technology=technologies.techname按问号分组。mark\u名称,技术。techname
请改进您的问题(示例数据、预期结果、观察结果等),不要复制答案。接受@scaisEdge给出的答案
mark | id
technology | id
SELECT m.mark_name
, t.techname
, COUNT(q.question)
FROM question_mark m
JOIN theoryquestion q
on q.mark = m.mark_name
and q.technology = t.techname
JOIN technologies
SELECT
question_mark.mark_name
,technologies.techname
,COUNT(theoryquestion.question)
FROM question_mark
INNER JOIN theoryquestion on theoryquestion.mark=question_mark.mark_name
INNER JOIN technologies theoryquestion.technology=technologies.techname
GROUP BY question_mark.mark_name ,technologies.techname