Skip to content
Advertisement

GROUP BY with Key:Value filters for each group

Given a table with following schema:

RecordId ProcessId Data
80830F00-379C-11EA-96B7-372060281AFC 1 4.2
80830F00-379C-11EA-96B7-372060281AFC 2 445588662211448
80830F00-379C-11EA-96B7-372060281AFC 7 1
791F6D30-379C-11EA-96B7-372060281AFC 1 3.3
791F6D30-379C-11EA-96B7-372060281AFC 2 999999999999999
791F6D30-379C-11EA-96B7-372060281AFC 7 2

So the RecordId represents some grouping key and each ProcessId has its Data.

Now I have a filter which looks like this:

So the key is ProcessId and value is Data.

Question

How can I get all RecordIds which satisfies query meaning that each group (grouped by RecordId) should contain specific processes with specific data.

I believe it should be used like this:

Advertisement

Answer

You can use having with case:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement