id combo
1 1
2 2
3 2
4 1
in this table i want only min id value for same cobmo,for example from the above table combo's are 1 and 2 i want only 2nd combo within 2nd combo i want only min id
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.


In SQL:
SELECT MIN(id) As MinId
FROM tblTemp
WHERE combo = 2
GROUP BY combo;
In LINQ:
int minId = (from p in records
group p by p.combo into g
where p.combo = 2
select new { combo = g.key, minid = g.id.Min() }).SingleOrDefault().minid;

Ananth GPosted Oct 25, 2016, 12:47 AM