0

Find the max value of a field

It looks like that the max function works for numbers. But my field has letters in it. How can I find the max value of this field? Thank you.

4 replies

null
    • Leonid_Semik
    • 5 yrs ago
    • Reported - view

    last()

     

    Leo

    • Mconneen
    • 5 yrs ago
    • Reported - view

    @Leonid... Last will give you last record in the set... so you need to combine that with an order by clause.. and to account for mixed ASCII sorting where lower case letters sort AFTER upper case.. you may want to convert them all to the same case .. if your search is to be case insensivity.. 

    Assume you have a People table.. .andt there is a column called 'Last Name' .. to find the greatest value of last name.. case insensitive... 

    let p:= last((select People) order by upper('Last Name'));
    p.'Last Name'

    • Leonid_Semik
    • 5 yrs ago
    • Reported - view

    That's right, I should have explained that before.

    • jhkevin1119
    • 5 yrs ago
    • Reported - view

    It works, thank you both!

Content aside

  • 5 yrs agoLast active
  • 4Replies
  • 1833Views