I have a table programparticipants
. I am currently successfully querying the IDs where count(name) > 1
. What I need now is to query the names that belong to those IDs where count(name) > 1
.
Example, data result currently being returned:
ID count(name)
1 2
3 4
4 3
Example, data result needed:
ID name
1 nm1
1 nm3
3 nm2
3 nm3
3 nm4
3 nm7
4 nm5
4 nm8
4 nm9
select count(id), name
from programparticipants
group by name
having count(id) > 1
You may use this:
SELECT
(SELECT name FROM participants WHERE id=p.participantid) AS name
FROM
programparticipants AS p
WHERE
.... (the part where you find count(name)>1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With