誰かが私のSQLクエリを解決するのを手伝ってください私はすでにこれに2日を費やしました....
以下に示すMYSQLクエリがあります
(SELECT
c.cl_list as cl_list,
c.name as name,
pc.value as value,
count( pc.value) as total
FROM
projs p
LEFT JOIN classify_proj_new pc
ON p.proj_id = pc.proj_id_fk
LEFT JOIN classify_list c
ON c.cl_list = pc.class_id_fk
WHERE
MATCH ( p.title ) AGAINST ( 'jerm' IN BOOLEAN MODE )
GROUP BY
c.cl_list,
pc.value)
UNION ALL
(SELECT
c.cl_list as cl_list,
c.name as name,
pc.value as value,
count( pc.value) as total
FROM
jerm p
LEFT JOIN classify_jerm_new pc
ON p.jerm_id = pc.jerm_id_fk
LEFT JOIN classify_list c
ON c.cl_list = pc.class_id_fk
WHERE
MATCH ( p.jermname ) AGAINST ( 'jerm' IN BOOLEAN MODE )
GROUP BY
c.cl_list,
pc.value)
これは(以下)の結果をもたらします:
cl_list name value total
------------------------------------------------------------------------------------
1 department jewller 2
3 price 50 2
6 color blue 1
6 color Red 2
1 department jewller 1
6 color Red 1
しかし、繰り返し値の合計を追加し、繰り返し値を回避できる結果を取得しようとしています....次のようなもの(以下):
cl_list name value total
------------------------------------------------------------------------------------
1 department jewller 3
3 price 50 2
6 color blue 1
6 color Red 3
誰かが私を助けてください私は私の出力について非常に悲しいです...
事前にどうもありがとうございました...