[GENERAL] Updating with a subselect

2008-04-23 Thread Leandro Casadei
Hi, I need to update a field from a table based in a count. This is the query: updateshops setitemsqty = ( select count(*) from items i1 join shops s1 on i1.shopid = s1.shopid where s1.shopid = s0.shopid ) from shops s0 The problem I'm having

Re: [GENERAL] Updating with a subselect

2008-04-23 Thread Leandro Casadei
On Wed, Apr 23, 2008 at 10:59 AM, Stephan Szabo < [EMAIL PROTECTED]> wrote: > On Tue, 22 Apr 2008, Leandro Casadei wrote: > > > Hi, I need to update a field from a table based in a count. > > > > This is the query: > > > > > > updateshop

[GENERAL] Extract only numbers from a varchar column

2008-05-06 Thread Leandro Casadei
I need to extract only the first occurence of numbers from a column that is varchar. Here are a few examples of what I need to do: abc200xx -> 200 340ppsdd -> 340 150ytyty555 -> 150 Can this be done by a simple query or do I need to use a cursor? Thanks

Re: [GENERAL] Extract only numbers from a varchar column

2008-05-06 Thread Leandro Casadei
-- Forwarded message -- From: Leandro Casadei <[EMAIL PROTECTED]> Date: May 5, 2008 2:08 PM Subject: Extract only numbers from a varchar column To: pgsql-general@postgresql.org I need to extract only the first occurence of numbers from a column that is varchar. Here are