如何将分组 ID 显示为具有各自值的列表?

How do I display grouped ID's as a list with their respective values?

如何不将所有 ID 分组,而是从头到尾列出;在它们旁边的列中显示它们各自的值?

与其分组,不如显示 ID 1 及其值、ID 2 及其值。即使 ID 的值相同。我尝试删除 GROUP_CONCAT,但它只显示每个 customfield_value?

的一个 ID
SELECT GROUP_CONCAT(virtuemart_product_id), customfield_value, COUNT(*) c
FROM jos_virtuemart_product_customfields
WHERE virtuemart_custom_id = 6
GROUP BY customfield_value
HAVING c > 1

它目前正在运行,但将 ID 分组并用逗号隔开。应该以正常 table/list 格式显示。

目前显示是这样的(如你所见,都是相同的ICOS编号,但ID不同。我只需要显示ICOS编号为"duplicate"的值):

   ID    ICOS  Count
1,2,3  775896      3

应该是这样显示的:

   ID    ICOS  Count
    1  775896      1
    2  775896      1
    3  775896      1

customfield_value 不唯一的所有行:

-- Assuming MySQL
SELECT virtuemart_product_id, customfield_value
   , COUNT(*) c -- maybe not needed
FROM jos_virtuemart_product_customfields
WHERE virtuemart_custom_id = 6
  AND customfield_value IN
 ( SELECT customfield_value
   FROM jos_virtuemart_product_customfields
   WHERE virtuemart_custom_id = 6
   GROUP BY customfield_value
   HAVING COUNT(*) > 1 -- more than one row exists
 ) 
GROUP BY virtuemart_product_id, customfield_value -- maybe not needed

如果 virtuemart_product_id 是唯一的,则不需要外部 count/group by 因为它始终为 1。