I want to get the top #nr_of_rows – (int)(#nr_of_rows / 10 – 1) of a table. So like if you have 63 rows, it would return 3 rows, 90 rows would return 10, 85 would return 5, etc.. Of course this can be done in two queries, just wondering if it can be done in one query.
If you guys know of a straight sql query, it would be great but ideally I would like a linq to sql answer.
or
or
I’m pretty weak on Linq to Sql but I don’t think you can’t avoid 2 lookups, since you’re still going to need to subquery to get the count(*), the sql generated would still have the subquery which this similiar post seems to validate LINQ version of TOP PERCENT