0

is there some way to determine the max value out of two values in SQL?

I use the mod function:

MOD(cnt, cnt/100)

This yields a division by 0 error when cnt is smaller than 100. I therefore would like something like this:

MOD(cnt, MAX(cnt/100, 1))
Chris
  • 11,108
  • 21
  • 70
  • 137

1 Answers1

2

You can use greatest

SELECT greatest(a, b, c) FROM your_table;
ScaisEdge
  • 129,293
  • 10
  • 87
  • 97