ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [Comm] Re: PostgreSQL string functions
@ 2003-02-04  9:31 Grigory Batalov
  0 siblings, 0 replies; only message in thread
From: Grigory Batalov @ 2003-02-04  9:31 UTC (permalink / raw)
  To: community

Tue, 4 Feb 2003 11:15:52 +0200 Dmytro O. Redchuk wrote:

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

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

Есть!
Несколько громоздко получилось, но зато работает:

select substring(login from position(chr(92) in login) + 1) as login,
sum(bytes) as bytes from squid_raw_log where time >= $time1 and time < $time2
group by substring(login from position(chr(92) in login) + 1) order by bytes
desc;

Что скажете? $time1 и $time2 задаются из php для уменьшения выборки.

-- 
 Grigory Batalov


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-04  9:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-04  9:31 [Comm] Re: PostgreSQL string functions Grigory Batalov

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