Re: [SQL] select xpath ...

2011-09-19 Thread Rob Sargent
Having a name space in the doc requires it's usage in the query.


On 09/17/2011 11:48 AM, boris wrote:
> hi all,
> I've inserted xml file :
>
> 
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
> 
> zz
> ..
>
>
> to a table:
>
> CREATE TABLE "temp".tempxml
> (
>   record xml
> )
>
> I can get it using:
> select * from temp.tempxml
>
>
> but, I can't get any values using xpath. ex:
>
>
>   select (xpath('/document/title/text()', record ))[1] from temp.tempxml
>
>
> am I doing it right?
>
> thanks.
>
>
>
>

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] Window function sort order help

2011-09-19 Thread Dianna Harter
Thank you.  It works perfect.

Dianna


Tim Landscheidt < [email protected] > wrote:


> If I understand the question correctly, try:
>
> | SELECT DISTINCT ON (consumer_id) consumer_id, move_date, history_timestamp
> |FROM (SELECT consumer_id, move_date, history_timestamp,
> | LAG(move_date) OVER (PARTITION BY consumer_id ORDER BY 
> consumer_id, history_timestamp) AS previous_move_date
> | FROM consumer_hist) AS SubQuery
> |WHERE move_date IS DISTINCT FROM previous_move_date
> |ORDER BY consumer_id, history_timestamp DESC;
>
> Tim

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] select xpath ...

2011-09-19 Thread boris

On 09/19/2011 10:49 AM, Rob Sargent wrote:

Having a name space in the doc requires it's usage in the query.


yeah, I got it... I was using wrong one...
thanks.





On 09/17/2011 11:48 AM, boris wrote:

hi all,
I've inserted xml file :


http://www.w3.org/2001/XMLSchema-instance";>
 
 zz
..


to a table:

CREATE TABLE "temp".tempxml
(
   record xml
)

I can get it using:
select * from temp.tempxml


but, I can't get any values using xpath. ex:


   select (xpath('/document/title/text()', record ))[1] from temp.tempxml


am I doing it right?

thanks.









--
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql