我有一张桌子
|| *content_value* || *content_const* || *language_language_id* ||
|| subtitle_1 || sub_1 || 1 ||
|| subtitle_2 || subtitle_2 || 1 ||
|| title_1 || heading_1 || 1 ||
|| title_2 || heading_2 || 1 ||
|| title_1 || heading_1 || 2 ||
|| title_1 || heading_1 || 2 ||
|| title_1 || heading_1 || 3 ||
|| title_2 || heading_2 || 3 ||
我需要使用新添加的content_const插回表行,但只能使用尚未存在的language_language_id变体。我有一个问题:
SELECT a.language_language_id
, b.content_value
, b.content_const
FROM content a
JOIN
( SELECT *
FROM .content
GROUP
BY .content.content_const
HAVING COUNT(.content.content_const) = 1
) b
WHERE a.language_language_id != b.language_language_id
结果:
|| *language_language_id* || *content_value* || *content_const* ||
|| 3 || subtitle_2 || subtitle_2 ||
|| 3 || subtitle_1 || sub_1 ||
|| 2 || subtitle_2 || subtitle_2 ||
|| 2 || subtitle_1 || sub_1 ||
|| 2 || subtitle_2 || subtitle_2 ||
|| 2 || subtitle_1 || sub_1 ||
|| 3 || subtitle_2 || subtitle_2 ||
|| 3 || subtitle_1 || sub_1 ||
结果很好,但我只需要没有重复的language_language_id和content_const变体的行。 RESP。结果如下:
|| *language_language_id* || *content_value* || *content_const* ||
|| 3 || subtitle_2 || subtitle_2 ||
|| 3 || subtitle_1 || sub_1 ||
|| 2 || subtitle_2 || subtitle_2 ||
|| 2 || subtitle_1 || sub_1 ||
感谢您的帮助