subQuery using Linq

Thread is closed for posting
1 posts, 0 answers
  1. Surekha
    Surekha avatar
    2 posts
    Member since:
    Oct 2017

    Posted 26 Oct 2017 Link to this post

    // sql returns records

    SELECT * FROM InfoDetails WHERE InfoId =( SELECT tOP 1 InfoId FROM InfoMaster WHERE recordid=1 ORDER BY CreationDate DESC)

     

    //returns 0 records

    db.InfoDetails.Where(u => u.InfoId ==(db.InfoMaster.Where(x => x.recordid == Id).OrderByDescending(x => x.CreationDate).Select(x => x.InfoId).FirstOrDefault())).Select(t=> new InfoListViewModel

    {fields}

     

    i need records in linq

Back to Top