[About The Guide]
Create a new database file by merging records/fields from two work areas
JOIN WITH <xcAlias> TO <xcDatabase>
FOR <lCondition> [FIELDS <idField list>]
WITH <xcAlias> is the name of the work area to merge with records
from the current work area. You can specify it either as a literal
alias or as a character expression enclosed in parentheses.
TO <xcDatabase> is the name of the target database file specified
either as a literal filename or as a character expression enclosed in
FOR <lCondition> selects only records meeting the specified
FIELDS <idField list> is the projection of fields from both work
areas into the new database file. To specify any fields in the
secondary work area, reference them with the alias. If the FIELDS
clause is not specified, all fields from the primary work area are
included in the target database file.
JOIN creates a new database file by merging selected records and fields
from two work areas based on a general condition. JOIN works by making
a complete pass through the secondary work area for each record in the
primary work area, evaluating the condition for each record in the
secondary work area. When the <lCondition> is true (.T.), a new record
is created in the target database file using the FIELDS specified from
both work areas.
If SET DELETED is OFF, deleted records in both source files (i.e., the
two files being JOINed) are processed. However, their deleted status is
not retained in the target <xcDatabase>. No record in the target file
is marked for deletion regardless of its deleted status in either of the
If SET DELETED is ON, no deleted records are processed in either of the
source files. Thus, deleted records do not become part of the target
<xcDatabase>. Similarly, filtered records are not processed and do not
become part of the target file.
Warning! The number of records processed will be the LASTREC() of
the primary work area multiplied by the LASTREC() of the secondary work
area. For example, if you have two database files with 100 records
each, the number of records JOIN processes is the equivalent of
sequentially processing a single database file of 10,000 records.
Therefore, use this command carefully.
. This example joins Customer.dbf to Invoices.dbf to produce
USE Invoices NEW
USE Customers NEW
JOIN WITH Invoices TO Purchases;
FOR Last = Invoices->Last;
FIELDS First, Last, Invoices->Number, ;
Files Library is CLIPPER.LIB.
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson