![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
i have a problem with the max value of a varchar field id docno description ================= 1 2 test1 2 F10 test2 select max(docno::text) as "docno" from table I woul like that it returns me F10, but it doesn't... how can i tell him to give me the max value without consider the char part? |
#3
| |||
| |||
|
|
Dade <cucca77NOSPAM (AT) nospamgmail (DOT) com> wrote: i have a problem with the max value of a varchar field id docno description ================= 1 2 test1 2 F10 test2 select max(docno::text) as "docno" from table I woul like that it returns me F10, but it doesn't... how can i tell him to give me the max value without consider the char part? You'll have to strip out the letters and convert to integer before computing the maximum. Something like this: SELECT max(regexp_replace(docno, '[^[:digit:]]', '', 'g')::integer) FROM "table" Yours, Laurenz Albe |
![]() |
| Thread Tools | |
| Display Modes | |
| |