Skip to content
Advertisement

Could not able to retrieve distinct rows from a Column based on the condition of another column in SQL server

I am new to SQL and I have a big table my_table having thousands of rows. The following is a sample:

What I want in the output is following:

Basically, I want the unique Ids which follow PricingRule as Rule1 from the JsonObject column. I tried the following code:

Advertisement

Answer

Try the following, here is the demo.

Output:

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