join query selecting starting rows as result even though where condition different

I have two sql tables. I am trying to join both table based SchemaId column and in result select rows which all matching where clause. But i am getting in result always first row of the table.Not expected output.

Not sure where i am doing wrong.

Issue facing:

-roles column role value always selecting first row of the table image -roles column permissions bool value not taking from table look like default as true. image

please see here is the db fiddler

Current table Result:

SchemaId roles

7a9a2521-45fb-4c9d-b7d9-e41927118119       {"role":"Senior Construction Manager","permissions":{"create":true,"read":true,"update":true,"delete":true}}

ca5d8707-fee8-4a5b-ad61-813785e32575       {"role":"Senior Construction Manager","permissions":{"create":true,"read":true,"update":true,"delete":true}}

Expected Table Result:

SchemaId roles

7a9a2521-45fb-4c9d-b7d9-e41927118119       {"role":"Project Manager","permissions":{"create":true,"read":true,"update":false,"delete":true}}
    
    ca5d8707-fee8-4a5b-ad61-813785e32575       {"role":"Project Manager","permissions":{"create":true,"read":true,"update":false,"delete":true}}

How to solve this and get expected result?

Thanks in advance.



Read more here: https://stackoverflow.com/questions/68473643/join-query-selecting-starting-rows-as-result-even-though-where-condition-differe

Content Attribution

This content was originally published by r08 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: