It's solved. Thank you very...very... much, Alec. --- Alec Brecher <alec@eresearchresources.com> wrote:
It goes like this:
insert into sven1 (custid, noapp) select custid, noapp from appointment where done='N' and salesid='6';
reading the documentation always helps:
http://www.postgresql.org/docs/7.4/static/sql-insert.html
-Alec
-----Original Message----- From: Prabu Subroto [mailto:prabu_subroto@yahoo.com] Sent: Thursday, July 22, 2004 9:45 AM To: suse-programming-e@suse.com Subject: RE: [suse-programming-e] populating (insert into...) a table with determined record from another table.
Dear my friend, Scott...
No, it does not work. Here is my try: kv=# insert into sven1 (custid, noapp) values (select custid, noapp from appointment where done='N' and salesid='6'); ERROR: syntax error at or near "select" at character 43 kv=#
Please keep telling.
Thank you very much in advance. --- "Wenzel, Scott" <scott_wenzel@BUDCO.com> wrote:
insert into sven1 (custid,nnoapp) values (select custid,noapp from appointment where done = 'N' and salesid = '6')
This will work if there are no other constraints on any of the other remaining fields in sven1
-----Original Message----- From: Prabu Subroto [mailto:prabu_subroto@yahoo.com] Sent: Thursday, July 22, 2004 9:24 AM To: suse-programming-e@suse.com Subject: [suse-programming-e] populating (insert into...) a table with determined record from another table.
Dear my friends...
I am using postgres and SuSE 9.1 .
I created a table (named : sven1). I want to populate this table with the record from another table (named : appoinment). but I don't know how to formulate the sql query.
I tried this one: insert into sven1 (custid, noapp) values ((select custid from appointment where done='N' and salesid='6'), (select noapp from appointment where done='N' and salesid='6'));
But I got this error in my psql console: kv=# insert into sven1 (custid, noapp) values ((select custid from appointment where done='N' and salesid='6'), (select noapp from appointment where done='N' and salesid='6')); ERROR: more than one row returned by a subquery used as an expression kv=#
Anybody would be so nice to help me solving this problem?
Thank you very much in advance.
__________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail