This is a migrated thread and some comments may be shown as answers.

subQuery using Linq

0 Answers 37 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Surekha
Top achievements
Rank 1
Surekha asked on 26 Oct 2017, 04:35 PM

// 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

Tags
LINQ (LINQ specific questions)
Asked by
Surekha
Top achievements
Rank 1
Share this question
or