Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: xpath_string and group by


  • From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
  • To: Perez <arturo(at)ethicist(dot)net>
  • Cc: pgsql-general(at)postgresql(dot)org
  • Subject: Re: xpath_string and group by
  • Date: Tue, 29 Aug 2006 12:54:58 +0200
  • Message-id: <20060829105458(dot)GB22806(at)svana(dot)org>

On Sat, Aug 26, 2006 at 03:51:06PM -0400, Perez wrote:
> Hi all,
> 
> Using 8.1.4 and contrib/xml2.  When I do a 
> 
> select xpath_string(note, '//Thing') as note,
>    count(aDate) from theTable
> group by lower(xpath_string(note, '//Thing'))
> order by 2 desc;
> 
> I get an error:
> GROUP BY must contain note.  
> But I can do that for a plain text/varchar field.  Adding the non-xpath 
> note field messes up the grouping.

I wonder if it's getting confused about which "note" you're referring
to in the GROUP BY clause.

> 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?

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

Attachment: signature.asc
Description: Digital signature



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group