1

I have a table (report) consist of several records and one of them about int values (column) I am trying to get the highest number of the fall_value column the id only primary key, the table as following:

id (P) fall_value date
3 1.2 2021-01-29
4 1.5 2021-01-30
5 1.6 2021-01-30
6 1 2021-01-31
7 5 2021-01-31
8 1.5 2021-01-31
9 1.5 2021-01-31
10 14 2021-01-31
11 15 2021-01-31

expected result: 15

I have tried the following inquiry:

SELECT max(fall_value) from report;

I got an unexpected result: 5

and also I got a message saying:

Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available

Dharman
  • 26,923
  • 21
  • 73
  • 125
hallsskd
  • 13
  • 4

1 Answers1

3

It sounds like fall_value is a string, not a number, and the string "5" is indeed greater than the string "15".

Try converting to a number. A convenient way is to use implicit conversion:

SELECT max(fall_value + 0) 
FROM report;
ysth
  • 92,097
  • 6
  • 117
  • 207
Gordon Linoff
  • 1,198,228
  • 53
  • 572
  • 709