I have 2 tables.
Tabel T1:
-----ID-----Name----
1 P1
2 P2
3 P3
Tabel T2:
-----ID-----PID----Type
1 1 T1
1 2 T2
1 3 T1
2 4 T3
2 5 T3
What I want:
----Name----Different_Types-----Type_Names
P1 2 T1,T2
What I have tried:
Select distinct T1.NAME,
count(distinct T2.Type) as Different_Types,
from T1
left join T2
on T2.ID = T1.ID
having count(distinct T2.PID) > 2
order by Different_Types desc
Whit this query I have the two first columns in my desired table, but having trouble adding the third....Any idea's ?