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
  • 30,962
  • 25
  • 85
  • 135
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
  • 96,171
  • 6
  • 121
  • 214
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786