Convert Sql to ling


  • SELECT [Id]
          ,(select MenuName from tbl_Menu where id= p.ParentId) parent
      FROM tbl_Menu p

    pls help convert this sql to ling. thanks.

    Friday, April 21, 2017 3:42 PM


  • Hello,

    Your query looks like you have a 1:1 relation between the tables, so why you use a sub-query at all, don't make much sense.

    Use a INNER JOIN instead and this can be accomplished in Linq in the same way, see Simple inner join

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by kufycode Friday, April 21, 2017 6:28 PM
    Friday, April 21, 2017 4:55 PM

All replies