Skip to content
Advertisement

Convert sql query to EF

Can anybody please help with this SQL query to transform it to EF Linq Expression?

I’ve been trying to do this for days, so I could really use some help.

Do you need extra info?

Thank you in advance.

Edit Here is a little part of the diagram, maybe it helps DB diagram

Advertisement

Answer

It seems the subqueries in both of your conditions in where clause is incorrect. Because your

group by column is missing in the select statement

And it is very unclear what you trying to achieve from the subqueries.

Without a clear understanding of your subqueries, all I can prepare for you is this.

Notes:

  • Alias for Income.Count and Income.Cost are changed because an object cannot contain exactly same nenter code hereamed property.
  • Linq for a proper subquery will replace new List<int>().
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement