-1

I have this query:

Select MAX(CAST(value As int)) from tableName

I want to get the max value of a column using entity formwork and put it on the corner of my website.

Nasser
  • 13
  • 1
  • 2
  • This question have already been answered here, https://stackoverflow.com/questions/7542021/how-to-get-max-value-of-a-column-using-entity-framework – Alen.Toma Jan 22 '19 at 22:52
  • Possible duplicate of [How to get max value of a column using Entity Framework?](https://stackoverflow.com/questions/7542021/how-to-get-max-value-of-a-column-using-entity-framework) – Matt Ke Jan 22 '19 at 23:26

1 Answers1

1

You are looking for the Max() method. Also use lambda expressions:

var max = context.TableName.Max(i => i.ColumnName);

(Where ColumnName is the column what you aggregate on.)