I wrote a LINQ query that it' result similar to this :
var res = from a in tbl
group a by {a.StateCode,a.CityCode} into grp
//where grp.Count() == 1
select ...
StateCode CityCode ......
------------------------------------------
01 001 ......
01 002 ......
02 001 ......
03 001 ......
03 002 ......
03 003 ......
indeed I want to get just 02 001
record because it has one result row in the final result.If I add commented code It returns count of records correspond to each group not count of own group.I know I can do this with two group by
but is there a better way to get row that has (for example) one row in the result?