the problem I have here is that I need all this, I just need to display it separately ...
The answer to your question: 1 query for 3,000 rows is better than 6 queries for 500 rows. (given that you revert all 3,000 rows back)
However, you do not want (want) to display 3,000 lines at a time, right? In all likelihood, regardless of using Linq, you'll want to run aggregate queries and get a database to do the job. You should hope that you can build SQL (or the Linq query) to execute all the necessary logic in one shot.
Not knowing what you are doing is hard to be more specific.
* If you absolutely need to return all the lines, then study the ToLookup () method for your linq IQueryable <T>. This is very convenient for grouping results in non-standard ways.
Oh, and I highly recommend LINQPad (free) for polling queries with Linq. It contains many examples, and also shows sql and lambda forms so you can familiarize yourself with the Linq β lambda β Sql form.
source share