I am working on converting a PostgreSQL query to SQL server and trying to understand what exactly the query below is doing . I understand the joins but the rest is not clear at all . Could anyone please help me out here .
select c.name
FROM CNT c
LEFT JOIN shares s ON
c.id = s.id AND s.username::name = "current_user"()
WHERE c.username::name = "current_user"() OR 'admin'::text = (( SELECT user_role_privs.granted_role
FROM user_role_privs
WHERE user_role_privs.granted_role = 'admin'::text)) OR s.username IS NOT NULL AND s.grantee_username::text <> ''::text