Tuesday, 15 June 2010

PostgreSQL SELECT last array key from text[] array column -


How do I make the last key from the SELECT array column?

  from the Select Table; + ---- + --------------- + | ID | Col_array | + ---- + --------------- + | 1 | {"A"} | + ---- + --------------- + | 2 | {"One", "b", "c"}. + ---- + --------------- + | 3 | {"B", "D", "F"}. The desired results for + ---- + --------------- +  

col_array will be: a, c , F.

use

  choose col_array [array_upper (col_array) 1)] from my_table  

No comments:

Post a Comment