From: | Eric BARROCA <eric(at)netsystems(dot)fr> |
---|---|
To: | Stuart Rison <rison(at)biochemistry(dot)ucl(dot)ac(dot)uk> |
Cc: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] INSERT and SELECT |
Date: | 1999-12-10 16:49:35 |
Message-ID: | 87emcuu4f4.fsf@venus.fondation |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Stuart Rison <rison(at)biochemistry(dot)ucl(dot)ac(dot)uk> writes:
> INSERT INTO table VALUES SELECT oid, 'test' FROM membre WHERE
> email="toto(at)toto(dot)com";
I've tried it, but it doesn't work too ("paser error near or at select"),
even if I replace " by '.
The sample table "table" :
- ID int4
- login varchar()
- password varchar()
I'd like to put into the ID culumn the result of (SELECT ...), into the
login column "test" and into the password one "testpass".
I've tried many queries like :
INSERT INTO table (id, login, password) VALUES SELECT oid, 'test',
'testpass' FROM membre WHERE email='toto(at)toto(dot)com';
or
INSERT INTO table (id, login, password) VALUES ((SELECT oid FROM membre
WHERE email='toto(at)toto(dot)com'), 'test', 'testpass');
or
INSERT INTO table (id, login, password) VALUES (SELECT oid, 'test',
'testpass' FROM membre WHERE email='toto(at)toto(dot)com');
...
But nothing give me a result. I get always parse error near select, and I
can't figure why.
Best Regards,
Éric.
From | Date | Subject | |
---|---|---|---|
Next Message | Ross J. Reedstrom | 1999-12-10 16:54:40 | Re: [SQL] INSERT and SELECT |
Previous Message | Nikolay Mijaylov | 1999-12-10 16:43:15 | Re: [SQL] INSERT and SELECT |