I have a table in my database. I want to get the maximum value of a column named NumOfView. I used this code:
var advert=(from ad in storedb.Ads
where ad.AdScope == "1"
select ad.NumOfView).Max();
It works but when there are two or more same maximum values it doesn’t work and this message appears:
Sequence contains more than one element
What should I do now? Your answers will be very helpfull. Thanks
You could try the following: