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
  • 13,100
  • 23
  • 79
  • 162

1 Answers1

2

You can use greatest

SELECT greatest(a, b, c) FROM your_table;
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107