RE: [SQL] UPDATE subselect?

From: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
To: Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>, pgsql-sql(at)postgreSQL(dot)org
Subject: RE: [SQL] UPDATE subselect?
Date: 1999-04-16 16:35:21
Message-ID: D05EF808F2DFD211AE4A00105AA1B5D20B8986@cpsmail
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

try:
UPDATE category
SET parent[0] = mfr.oid
FROM mfr
WHERE mfr.name='canon';

-DEJ

> José Soares wrote:
> >
> > Take a look at PostgreSQL User's Guide
> > Chapter 10. Arrays
>
> Which doesn't help me because I need to update individual array elements
> from subselects.
>
> >
> > syntax:
> > INSERT INTO SAL_EMP
> > VALUES ('Bill',
> > '{10000, 10000, 10000, 10000}',
> > '{{"meeting", "lunch"}, {}}');
> >
> > José
> >
> > Chris Bitmead ha scritto:
> >
> > > What is the correct syntax for this UPDATE?
> > >
> > > CREATE TABLE category (
> > > name text,
> > > image text,
> > > url text,
> > > parent oid[]
> > > );
> > > update category set parent = '{0,0}' where name='slr';
> > > So far so good...
> > > update category set parent[0] = (SELECT oid from mfr where
> > > name='canon');
> > > ERROR: parser: parse error at or near "select"
> > >
> > > --
> > > Chris Bitmead
> > > http://www.bigfoot.com/~chris.bitmead
> > > mailto:chris(dot)bitmead(at)bigfoot(dot)com
>
> --
> Chris Bitmead
> http://www.bigfoot.com/~chris.bitmead
> mailto:chris(dot)bitmead(at)bigfoot(dot)com

Browse pgsql-sql by date

  From Date Subject
Next Message Henrik Pedersen 1999-04-16 16:38:13 How to compare Datetime
Previous Message Chairudin Sentosa 1999-04-16 15:47:07 Update on 6.5