SQL クエリに問題があります。
次の表があります(少し簡略化しました):
ChainId ComponentId TransmitEndpointId
1 156 NULL
1 156 7
1 157 7
2 510 6
2 510 6
2 511 6
2 511 8
私がする必要があるのは、「一意の」ChainId で TransmitEndpointId の foreach の「一意の」ComponentId の数を取得することです。したがって、上記のデータの結果は次のようになります: 5 (チェーン 1 の 2 つの一意の componentId & チェーン 2 の 2 つの一意の componentId と 2 つの異なる TransmitId ==> NULL 値はカウントされません)
これは非常に複雑で、このクエリを開始する方法がわかりません。
誰でも助けることができますか?
前もって感謝します。