Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!fciva!dag From: dag@fciva.FRANKLIN.COM (Daniel A. Graifer) Newsgroups: comp.databases Subject: Relational Database Question Message-ID: <542@fciva.FRANKLIN.COM> Date: 29 Aug 90 16:39:35 GMT Reply-To: uunet!fciva!dag (Daniel A. Graifer) Distribution: na Organization: Franklin Mortgage Capital Corp., McLean, Va. Lines: 51 Keywords: I am trying to add the following capability to an existing Unify 4 database, (but I think the question is valid in any implementation). The existing database contains a table of items identified by an itemkey. I want to add the ability to generate reports with items subtotaled in sets contained in the database. We should be able to store several such groups of item-sets. TABLE items itemkey * STRING 6 . . . TABLE rptgrp grpname * STRING 6 grpdesc STRING 20 TABLE rptset setkey * COMB setname STRING 6 part of setkey ofgrp Ref to grpname part of setkey setdesc STRING 20 TABLE item2grp /* Case 1 */ i2gkey * COMB item Ref to itemkey part of i2gkey set Ref to setkey part of i2gkey TABLE item2grp /* Case 2 */ i2gkey * COMB item Ref to itemkey part of i2gkey grp Ref to grpname part of i2gkey set Ref to setname The first case doesn't correctly express the relationship: Items must be uniquely assigned within each group. Case 1 would permit the assignment of an item to two sets within the same group. The second case permits an item to be assigned to a non-existant set/group combination, ie one which doesn't occur in rptset. One way of presenting the question is relative to Case 1: How do I make a subfield of the combined field 'set' part of the unique key for item2grp? Any help greatly appreciated. Dan P.S. Reply to uunet.uu.net!fciva!dag. My newsposter is editting my .signature file into garbage! -- Daniel A. Graifer Franklin Mortgage Capital Corporation uunet!dag@fmccva.franklin.com 7900 Westpark Drive, Suite A130 (703)448-3300 McLean, VA 22102