none
Convert Sql to ling

    Question

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

    pls help convert this sql to ling. thanks.

    Friday, April 21, 2017 3:42 PM

Answers

  • 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
    Moderator

All replies