Re: xpath_string and group by

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: xpath_string and group by
Дата
Msg-id 20060829120334.GC22806@svana.org
обсуждение исходный текст
Ответ на Re: xpath_string and group by  (Arturo Perez <aperez@hayesinc.com>)
Список pgsql-general
On Tue, Aug 29, 2006 at 07:05:44AM -0400, Arturo Perez wrote:
> > > select note, count(aDate) from
> > >   (select  lower(xpath_string(note, '//Thing')) as note, aDate from
> > > theTable) as foo
> > > group by note
> >
> > This is about the same thing, so why not use that?
>
> You're right, it is almost the same thing.  But the second form loses
> the case of the original - everything is returned lower case.  If I must
> I must but I'ld like to preserve the case is possible.

Oh I see, you want to group thing ignoring case, but want to keep the
case and presumably you don't care which version you get.

Well, how about:

select max(note), count(aDate) from
  (select  xpath_string(note, '//Thing') as note, aDate from  theTable) as foo
group by lower(note);

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Geoffrey
Дата:
Сообщение: Re: speeding up big query lookup
Следующее
От: Douglas McNaught
Дата:
Сообщение: Re: database files are incompatible with server, after