I have a table that stores me that stores three numbers and an ID.
NUMERO1 NUMERO2 NUMERO3 ID
14070 4641 24155 1
14070 4780 24155 2
14070 4333 24155 3
15000 4303 24000 2
16000 4003 17000 1
I would like to get those records that have same number1 and number 3 but with more than one ID. That is, I would like to take only these three records
NUMERO1 NUMERO2 NUMERO3 ID
14070 4641 24155 1
14070 4780 24155 2
14070 4333 24155 3
I've tried with the following query, but it does not work for me, I do not know what I'm doing wrong with
SELECT
NUMERO1, NUMERO2, NUMERO3, ID
FROM
TABLA
GROUP BY
(NUMERO1, NUMERO3, ID)
HAVING
COUNT(ID)>1