Select rows with same id but different value in another column

后端 未结 8 1605
名媛妹妹
名媛妹妹 2020-12-08 01:50

I tried for hours and read many posts but I still can\'t figure out how to handle this request:

I have a table like this:

+------+------+
|ARIDNR|LIE         


        
8条回答
  •  感情败类
    2020-12-08 02:27

    You can simply achieve it by

    SELECT *
    FROM test
    WHERE ARIDNR IN
        (SELECT ARIDNR FROM test
         GROUP BY ARIDNR
         HAVING COUNT(*) > 1)
    GROUP BY ARIDNR, LIEFNR;
    

    Thanks.

提交回复
热议问题