Search code examples
c#sqlms-accessoledb

How do you return the max of a column (Text field)?


I can not find a way to execute the following simple query:

SELECT max(@SomeCol) FROM test_table;

I can do just about everything else except for that, max doesn't return what I expect.


Solution

  • You may be able to workaround the issue by loading the dB query/table into a .Net DataTable and use it's Compute method:

    DataTable.Compute("AggregateFunction(DataColumn)", "condition|Nothing|null")