pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sarlav kumar <sarlavk@yahoo.com>
To: pgsql-novice@postgresql.org
Subject: Re: INSERT question
Date: Mon, 13 Dec 2004 10:31:13 -0800 (PST)
Message-ID: <20041213183113.58578.qmail@web51310.mail.yahoo.com> (raw)
In-Reply-To: <25641.1102956494@sss.pgh.pa.us>

Thanks!! that worked!:)

Tom Lane <tgl@sss.pgh.pa.us> wrote:sarlav kumar writes:
> Is there a way to write the INSERT as follows?

> INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203, 
> (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1);

> I tried this, but I get the following problem:
> ERROR: More than one tuple returned by a subselect used as an expression.

INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) 
SELECT 1203, code, 'true', 1 FROM country
WHERE send IS NOT NULL OR receive IS NOT NULL;

regards, tom lane


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

view thread (6+ messages)  latest in thread

Message-ID: <20041213183113.58578.qmail@web51310.mail.yahoo.com>
Permalink:  ../20041213183113.58578.qmail@web51310.mail.yahoo.com/
Also on:    postgresql.org/message-id/20041213183113.58578.qmail@web51310.mail.yahoo.com

 · 

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-performance@postgresql.org
  Cc: sarlavk@yahoo.com, pgsql-novice@postgresql.org
  Subject: Re: INSERT question
  In-Reply-To: <20041213183113.58578.qmail@web51310.mail.yahoo.com>

* 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