| From: | sarlav kumar <sarlavk(at)yahoo(dot)com> |
|---|---|
| To: | pgsql-novice(at)postgresql(dot)org |
| Subject: | Re: INSERT question |
| Date: | 2004-12-13 18:31:13 |
| Message-ID: | 20041213183113.58578.qmail@web51310.mail.yahoo.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice pgsql-performance |
Thanks!! that worked!:)
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | sarlav kumar | 2004-12-13 18:33:08 | Re: INSERT question |
| Previous Message | Michael Fuhr | 2004-12-13 17:21:03 | Re: Get comment |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Josh Berkus | 2004-12-13 18:31:40 | Re: Hardware purchase question |
| Previous Message | Josh Berkus | 2004-12-13 18:25:54 | Re: pg_restore taking 4 hours! |