[SQL] Find the maximum between 2 fields

bahcham Posted messages 3 Status Member -  
 abdallah_mehdoini -
Hello everyone.
I would like to know a method using SQL that allows to get the maximum between two fields in a database.
Example:
Student ........Final Control Score....... Make-up Score...... Max Score

....X ..........................10..................... 12......................... 12
....Y ...........................8....................... 7........................... 8
....Z ..........................10 ......................10 ..........................10

5 answers

  1. Yann
     
    Hello!

    I'm sorry, but since I'm not currently on a machine with Oracle, I can't run any tests. But if I were you, I'd try something with the GREATEST function.
    It allows you to compare multiple values (text, date, or number).
    Something like GREATEST(final_control_score, makeup_score) should work.

    See you!
    3
    1. bahcham Posted messages 3 Status Member
       
      Thank you very much for this response and the interest in my problem. The issue is that I am working on Access, so the GREATEST function does not work.
      I am looking for a function that does the same thing as GREATEST.

      Thank you infinitely.
      0