locked
How to convert sql to LINQ RRS feed

  • Question

  • User87195929 posted

    Hi all

    I have sql query 

    so please convert it in to LINQ

    select Distinct tblSysOrganization.OrgID, tblSysOrganization.Name,tblSysOrganization.IsActive from tblSysOrganization where tblSysOrganization.OrgID IN(select tblSysOrganizationMap.SisterOrgID from tblSysOrganizationMap where tblSysOrganizationMap.ParentOrgID=5)


    UNION

    select tblSysOrganization.OrgID, tblSysOrganization.Name,0 from tblSysOrganization where tblSysOrganization.Name NOT IN( select Distinct tblSysOrganization.Name from tblSysOrganization where tblSysOrganization.OrgID IN(select tblSysOrganizationMap.SisterOrgID from tblSysOrganizationMap where tblSysOrganizationMap.ParentOrgID=5))

    I am not able to find any solution also

    Thanks and Regards

    siddu

    Saturday, September 21, 2019 6:54 AM

All replies

  • User665608656 posted

    Hi siddangoud,

    select Distinct tblSysOrganization.OrgID, tblSysOrganization.Name,tblSysOrganization.IsActive from tblSysOrganization where tblSysOrganization.OrgID IN(select tblSysOrganizationMap.SisterOrgID from tblSysOrganizationMap where tblSysOrganizationMap.ParentOrgID=5)


    UNION

    select tblSysOrganization.OrgID, tblSysOrganization.Name,0 from tblSysOrganization where tblSysOrganization.Name NOT IN( select Distinct tblSysOrganization.Name from tblSysOrganization where tblSysOrganization.OrgID IN(select tblSysOrganizationMap.SisterOrgID from tblSysOrganizationMap where tblSysOrganizationMap.ParentOrgID=5))

    Because your SQL statements are complex, I recommend that you use online conversion tools to convert SQL statements into LINQ.

    Here is the download link : http://www.sqltolinq.com/

    This is a link to how to use the conversion tool : Linqer – a nice tool for SQL to LINQ transition

    Best Regards,

    YongQing.

    Monday, September 23, 2019 2:02 AM