Thread: HOW DO I...
To All, How do I select from one table into another table that already exists? In other words, if I do a: select * into tblB from tblA where attrN like 'xxx'; and both table structures are identical I get a ERROR: Relation 'tblB' already exists If I : select * into table tblB from tblA where attrN like 'xxx'; I get the same answer. I also tried using 'update' So, How do I update a smaller table from a larger table? For those who wish to know, This is a large parts database that is updated monthly and I have divided it into smaller subsections for quick access through a web-based interface. Searching the original table is much too time consuming ( over 130,000 part #'s with Specs and Descriptions - all running on an ancient 80386). And I would like to avoid updating the smaller tables by re-building them from scratch. Thanks for your time, John C. ___________________________________________________________________ Get the Internet just the way you want it. Free software, free e-mail, and free Internet access for a month! Try Juno Web: http://dl.www.juno.com/dynoget/tagj.
Hello, On Fri, 15 Oct 1999, John C Cusick wrote: > In other words, if I do a: > select * into tblB from tblA where attrN like 'xxx'; > > and both table structures are identical I get a > ERROR: Relation 'tblB' already exists Correct, the 'select into...' statement attempts to create the table, not just insert rows. I had this problem on a different system (which I haven't tried to do in pgsql), where the solution was: insert into tbl1 select * from tbl2 where this = that I *think* you could declare a value list as in a normal insert. I also think that this is SQL, not something specific to that db system, but I may be wrong. Regards, Mark. -- Mark Jewiss Knowledge Matters Limited http://www.knowledge.com
On Fri, Oct 15, 1999 at 08:54:01AM -0400, John C Cusick allegedly wrote: > To All, > > How do I select from one table into another table > that already exists? > > In other words, if I do a: > select * into tblB from tblA where attrN like 'xxx'; > > and both table structures are identical I get a > ERROR: Relation 'tblB' already exists > > If I : select * into table tblB from tblA where attrN like 'xxx'; > > I get the same answer. > > I also tried using 'update' > > So, How do I update a smaller table from a larger table? > > For those who wish to know, This is a large parts database that > is updated monthly and I have divided it into smaller subsections for > quick access through a web-based interface. Searching the original > table is much too time consuming ( over 130,000 part #'s with Specs and > Descriptions - all running on an ancient 80386). And I would like > to avoid updating the smaller tables by re-building them from scratch. > > Thanks for your time, > > John C. Shouldn't you be doing the following? insert into tblB select * from tblA where attrN like 'xxx'; Mathijs