pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedNeeds Query
3+ messages / 3 participants
[nested] [flat]
* Needs Query
@ 2007-05-08 12:18 Penchalaiah P. <penchalaiahp@infics.com>
0 siblings, 1 reply; 3+ messages in thread
From: Penchalaiah P. @ 2007-05-08 12:18 UTC (permalink / raw)
To: pgsql-sql
In a table, a column contains
Suneelllllllllllllll
Sudhakarrrrrrrrrr
Vivekkkkkkkkkk
Ramanaaaaaaaaa
But my output is
Suneel
Sudhakar
Vivek
Ramana
I want a query to get my output like above........
Please solve my problem ASAP
Regards
penchal
========================================================================
====================================================
Disclaimer:
This message and the information contained herein is proprietary and
confidential and subject to the Tech Mahindra policy statement, you may
review at http://www.techmahindra.com/Disclaimer.html externally and
http://tim.techmahindra.com/Disclaimer.html internally within Tech
Mahindra.
========================================================================
====================================================
Information transmitted by this e-mail is proprietary to Infinite Computer Solutions and / or its Customers and is intended for use only by the individual or the entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at info.in@infics.com and delete this email from your records.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Needs Query
@ 2007-05-08 12:58 A. Kretschmer <andreas.kretschmer@schollglas.com>
parent: Penchalaiah P. <penchalaiahp@infics.com>
0 siblings, 1 reply; 3+ messages in thread
From: A. Kretschmer @ 2007-05-08 12:58 UTC (permalink / raw)
To: pgsql-sql
am Tue, dem 08.05.2007, um 17:48:47 +0530 mailte Penchalaiah P. folgendes:
>
>
>
>
>
>
>
>
> In a table, a column contains
>
>
>
> Suneelllllllllllllll
>
> Sudhakarrrrrrrrrr
>
> Vivekkkkkkkkkk
>
> Ramanaaaaaaaaa
>
>
>
>
>
> But my output is
>
> Suneel
>
> Sudhakar
>
> Vivek
>
> Ramana
>
> I want a query to get my output like above??..
write a stored proc. within this proc: (oversimplified)
- calculate the length of the string with length() -> length
- extract substring(string, length, length) -> last_char
- regexp_replace(string, last_char||'*$', last_char)
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Needs Query
@ 2007-05-08 14:00 Reuven Abliyev <reuvenab@gmail.com>
parent: A. Kretschmer <andreas.kretschmer@schollglas.com>
0 siblings, 0 replies; 3+ messages in thread
From: Reuven Abliyev @ 2007-05-08 14:00 UTC (permalink / raw)
To: Penchalaiah P. <penchalaiahp@infics.com>; +Cc: pgsql-sql
or if you want it in the one query:
>create table _t(f varchar(50));
select f, case when substr(f, length(f), 1)= substr(f, length(f)-1, 1) then
regexp_replace(f, substr(f, length(f), 1)||'+$', substr(f, length(f), 1))
else f end from _t where length(f)>1;
On 5/8/07, A. Kretschmer <andreas.kretschmer@schollglas.com> wrote:
>
> am Tue, dem 08.05.2007, um 17:48:47 +0530 mailte Penchalaiah P.
> folgendes:
> >
> >
> >
> >
> >
> >
> >
> >
> > In a table, a column contains
> >
> >
> >
> > Suneelllllllllllllll
> >
> > Sudhakarrrrrrrrrr
> >
> > Vivekkkkkkkkkk
> >
> > Ramanaaaaaaaaa
> >
> >
> >
> >
> >
> > But my output is
> >
> > Suneel
> >
> > Sudhakar
> >
> > Vivek
> >
> > Ramana
> >
> > I want a query to get my output like above??..
>
> write a stored proc. within this proc: (oversimplified)
>
> - calculate the length of the string with length() -> length
> - extract substring(string, length, length) -> last_char
> - regexp_replace(string, last_char||'*$', last_char)
>
>
> Andreas
> --
> Andreas Kretschmer
> Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
> GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2007-05-08 14:00 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-05-08 12:18 Needs Query Penchalaiah P. <penchalaiahp@infics.com>
2007-05-08 12:58 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2007-05-08 14:00 ` Re: Needs Query Reuven Abliyev <reuvenab@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox