ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [Comm] Re: PostgreSQL string functions
@ 2003-02-04  8:12 Grigory Batalov
  2003-02-04  8:45 ` Maxim Tyurin
  0 siblings, 1 reply; 3+ messages in thread
From: Grigory Batalov @ 2003-02-04  8:12 UTC (permalink / raw)
  To: community

Tue, 4 Feb 2003 10:57:30 +0300 Korshunov Ilya wrote:

>> Собственно, вопрос:
>> Есть ли в postgres такая функция strstr, substr или им подобные,
>> чтобы сделать сразу select substr(strstr(login,'\'),1) as login ?
>> Или можно решить эту задачу другим способом?

>не очень въехал в суть проблемы...

Пример:
select login, sum(bytes) as bytes from squid_raw_log where time >= $time1 and time < $time2 group by login order by bytes desc

возвращает:

uprav_nt\gvf => 22881837
uprav_nt\ben1 => 8947084
uprav_nt\osa => 4804259
uprav_nt\paa => 4041611
uprav_nt\vds => 3987697
ben1 => 1281094
uprav_nt\dvt => 827048
uprav_nt\kna => 802962
uprav_nt\paa1 => 520926
uprav_nt\rea => 471475
dvt => 117810
root => 1753

где uprav_nt\dvt и dvt - один и тот же человек.
Хочу их складывать ещё привыборке. Как вычленить "uprav_nt\",
если оно есть?

--
 Grigory Batalov


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Comm] Re: PostgreSQL string functions
  2003-02-04  8:12 [Comm] Re: PostgreSQL string functions Grigory Batalov
@ 2003-02-04  8:45 ` Maxim Tyurin
  2003-02-04  9:15   ` Dmytro O. Redchuk
  0 siblings, 1 reply; 3+ messages in thread
From: Maxim Tyurin @ 2003-02-04  8:45 UTC (permalink / raw)
  To: community

> >> Собственно, вопрос:
> >> Есть ли в postgres такая функция strstr, substr или им подобные,
> >> чтобы сделать сразу select substr(strstr(login,'\'),1) as login ?
> >> Или можно решить эту задачу другим способом?

Например напиши функцию на plperl (на perl уж строками как угодно
крутить можно) 
-- 

With Best Regards, Maxim Tyurin
mailto: MrKooll@mail.ru
JID:	MrKooll@jabber.pibhe.com
			


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Comm] Re: PostgreSQL string functions
  2003-02-04  8:45 ` Maxim Tyurin
@ 2003-02-04  9:15   ` Dmytro O. Redchuk
  0 siblings, 0 replies; 3+ messages in thread
From: Dmytro O. Redchuk @ 2003-02-04  9:15 UTC (permalink / raw)
  To: Maxim Tyurin; +Cc: ALT Community

On Tue, Feb 04, 2003 at 10:45:05AM +0200, Maxim Tyurin wrote:
> > >> Собственно, вопрос:
> > >> Есть ли в postgres такая функция strstr, substr или им подобные,
> > >> чтобы сделать сразу select substr(strstr(login,'\'),1) as login ?
> > >> Или можно решить эту задачу другим способом?
Мне кажется, можно.
(Там в доке много строковых функций).

(Или ошибаюсь?..)

> 
> Например напиши функцию на plperl (на perl уж строками как угодно
> крутить можно) 
> -- 
> 
> With Best Regards, Maxim Tyurin
> mailto: MrKooll@mail.ru
> JID:	MrKooll@jabber.pibhe.com
-- 
  _,-=._              /|_/|
  `-.}   `=._,.-=-._.,  @ @._,
     `._ _,-.   )      _,.-'
        `    G.m-"^m`m'        Dmytro O. Redchuk


Uncompensated overtime?  Just Say No.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-02-04  9:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-04  8:12 [Comm] Re: PostgreSQL string functions Grigory Batalov
2003-02-04  8:45 ` Maxim Tyurin
2003-02-04  9:15   ` Dmytro O. Redchuk

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git