Article View: borland.public.vdbase.data.sql
Article #1133VDB7.01 Relating two tables
From: H. W. Andersen
Date: Thu, 16 Apr 1998 00:00
Date: Thu, 16 Apr 1998 00:00
35 lines
2134 bytes
2134 bytes
I have created two tables. Archive.dbf is the invoice header record (name, address, date, invoice number, etc.) Archivep.dbf is the invoice line information (invoice number, quantity, catalog number, etc.) An invoice is made up of one Archive record and one or more Archivep records. They are related using the invoice number field in each record. The SQL query syntax is as follows: SELECT Archive.INVOICE_NO, Archive.TERRITORY, Archive.TYPE, Archive."DATE", Archive.OPERATOR, Archive.PO_NUMBER, Archive.SHIPTOPONU, Archive.SUBTOTAL, Archive.TOTAL_AMT, Archive.DISCOUNT, Archive.CREDIT_AMT, Archive.CREDIT_NUM, Archive.PAY_FLAG, Archive.CWO_LOC, Archive.TERMS, Archive.TAX_AMOUNT, Archive.SHIP_CODE, Archive.SHIP_COST, Archive.HAZMAT, Archive.WEIGHT, Archive.CUST_NUM, Archive.PRICE_LIST, Archive.BALANCE, Archive.RECEIVABLE, Archive.DATE_PAID, Archive.SHIP_NAME, Archive.SHIP_ADDR1, Archive.SHIP_ADDR2, Archive.SHIP_CITY, Archive.SHIP_STATE, Archive.SHIP_ZIP, Archive.NUMOFLABEL, Archive.INVMEMO, Archivep.QUANTITY, Archivep.CATALOG, Archivep.LOT, Archivep.PRICE FROM "C:\ANCAL\INVODATA\archive.dbf" Archive INNER JOIN "C:\ANCAL\INVODATA\archivep.dbf" Archivep ON (Archive.INVOICE_NO = Archivep.INVOICE_NO) ORDER BY Archive.INVOICE_NO This gives me the appropriate Archivep records associated with their Archive record. I want to further limit this to one invoice number so that a grid on the form displays only the Archivep records that are associated with the Archive record. Presently, all of the Archivep records are displayed. It seems to me this calls for a WHERE clause but I canοΏ½t construct one that works. How do I do that?
Technical Details
Message-ID:
<6h5pug$92q22@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: ff5a1,40162800516bf33c,start X-Google-Attributes: gidff5a1,public From: "H. W. Andersen" <mailbox@anpro.com> Subject: VDB7.01 Relating two tables Date: 1998/04/16 Message-ID: <6h5pug$92q22@forums.borland.com> X-Deja-AN: 344788612 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.vdbase.data.sql