Re: ask: select right(column) ???

From: Ludwig Kniprath <ludwig(at)kni-online(dot)de>
To: <penguinroad(at)gmail(dot)com>
Subject: Re: ask: select right(column) ???
Date: 2009-02-16 08:47:02
Message-ID: 12861284.1388121234774022853.JavaMail.servlet@kundenserver
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Hendra,
there is no function right(column, n-Chars), but you can use substring(column-name from offset for num_chars) in combination with char_length for getting the right-n-characters as f. e.:

select substring(column from (char_length(column) - 3) for 4) from table

Ludwig

>Dear all,
>
>I have simple question
>I tried following code
>
> select right(column, number_of_character) from table
>
>but it didn't work, saying that pg doesn't have the function
>is there any way to achieve such output?
>
>honestly I have no idea that such simple feature doesn't exist in postgresql
>or am I wrong? since I look at SQL Key Words table and it's written as
>reserved
>
>Thank you
>Regards
>Hendra

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2009-02-16 10:26:13 idle DB and resources
Previous Message hendra kusuma 2009-02-16 08:21:20 ask: select right(column) ???