Re: SQL Question
Posted in 1997
Topics: General Discussion
In Article<01bc80af$11409ad0$09006480@dev>, <kist@buffnet.net> writes: > Path: news1.stny.lrun.com!news-out.internetmci.com!newsfeed.internetmci.com!news-peer.sprintlink.net!news-pull.sprintlink.net!news-in-east.sprintlink.net!news.sprintlink.net!Sprint!205.246.19.53!buffnet2.buffnet.net!not-for-mail > From: "Jim Kist" <kist@buffnet.net> > Newsgroups: alt.comp.databases,alt.comp.databases.xbase,comp.database,comp.database.ingres,comp.database.oracle,comp.databases,comp.databases.informix,comp.databases.ingres,comp.databases.ms-sqlserver,comp.databases.oracle,comp.databases.oracle.misc,comp.d > Subject: SQL Question > Date: 24 Jun 1997 14:59:52 GMT > Organization: BuffNET > Lines: 47 > Message-ID: <01bc80af$11409ad0$09006480@dev> > NNTP-Posting-Host: fppp23.buffnet.net > X-Newsreader: Microsoft Internet News 4.70.1161 > Xref: news1.stny.lrun.com alt.comp.databases:360 alt.comp.databases.xbase:161 comp.database:237 comp.database.ingres:32 comp.database.oracle:1345 comp.databases:66152 comp.databases.informix:46842 comp.databases.ingres:24588 comp.databases.ms-sqlserver:8150 comp.databases.oracle.misc:5624 > > I have a set of tables, a master table and two detail tables. The detail > tables have at most 5 records for each master record. I need to move these > records to a flat file that has one record each set of master detail > records. How do I go about doing this? > > Example: > Master Table > =========== > Id > Name > City > > Detail Table 1 > =========== > Id > Code > > Detail Table 2 > =========== > Id > Date > > All tables are related by the 'Id' field. These records must go into the > following table: > > Output > =========== > Id > Name > City > Code_1 > Code_2 > Code_3 > Code_4 > Code_5 > Date_1 > Date_2 > Date_3 > Date_4 > Date_5 > > > Thanks for any help, > > Jim > > You may have to research and use the 'cursor' functionality to accomplish this. In simple terms it allows you to read multiple rows before outputting a single row.