SQL query for left join which give my desire result is as follow. i can use left join or sub select, though I prefer to use left join but I am Ok with subselect also.
I don't know how to write this query in sqlalchemy. I refered document, but my query differes on join key as I have more than one filter on join key. . SELECT R.roleId, R.name, R.description from roles R left join roleElements RE on R.roleId = RE.roleId and RE.isActive = 'Y' and RE.elementId = 1 and RE.elementLevelId = 1 where RE.roleId IS NULL OR SELECT * FROM roles WHERE roleId not in (select roleId from roleElements where elementLevelId = 1 and elementId = 1 and isActive= "Y") note: In actual query, values of RE.elementId and RE.elementLevelId would be variable. I really stuck here and tried a lot but couldn't get it. Hopping any help. Thank you in advance. Aruna Kathiriya --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---