pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Tuliao <jptuliao@eglobalreach.net>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: How can I use this subselect properly in an update?
Date: Fri, 17 Feb 2012 15:52:13 +0800
Message-ID: <4F3E072D.8030806@eglobalreach.net> (raw)

select
     substring(t1.called_number from t2.offset),
     t1.called_number
from
     calls_join as t1,
     john_prefix as t2
where
     strpos(t1.called_number, t2.prefix) = '1'
     order by length(t2.prefix) desc limit '1' ;

I'm having trouble using this as a sub-select in an UPDATE. Most of the 
time it works. Then sometimes it doesn't.
Is there an issue with possible NULL values that can be found on table1 
(t1)?




Message-ID: <4F3E072D.8030806@eglobalreach.net>
Permalink:  ../4F3E072D.8030806@eglobalreach.net/
Also on:    postgresql.org/message-id/4F3E072D.8030806@eglobalreach.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jptuliao@eglobalreach.net
  Subject: Re: How can I use this subselect properly in an update?
  In-Reply-To: <4F3E072D.8030806@eglobalreach.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox