I am having issues with a sql query.
I have following table (I simplified it a bit):
ChainId ComponentId TransmitEndpointId
1 156 NULL
1 156 7
1 157 7
2 510 6
2 510 6
2 511 6
2 511 8
What I need to do is get the number of TransmitEndpointId’s foreach ‘unique’ ComponentId in a ‘unique’ ChainId.
So the result of the above data would be: 5 (2 unique componentId’s in Chain 1 & 2 unique componentId’s in Chain 2 with 2 different TransmitId’s ==> NULL values don’t count)
This is quite complex and have no idea on how to start with this query.
Can anybody help?
Thanks in advance.
add the
where TransmitEndpointId is not nullor you will get a 0 because of the NULLEDIT (why add
TransmitEndpointId is not null)