There is a great tool called LinqPad
]. Download, and install it. The free version will be more than enough.
prepare a proper data connextion so you can execute your LINQ query. At that point click to the "SQL" view, and you will see the generated SQL statements (like here
But if this query runs on LINQ to Objects bot not on LINQ to EF or LINQ to SQL, it won't run in LinqPad either. In this case you will probably need to use some SqlFunctions
], or if this is not enough. If this is still not enough, you can have a first pass on SQL/EF (by filtering as much as you can), than after a ToList() you have everything that's available on Objects as a second pass.