C5_JOIN

 JOIN 
 Create a new database file by merging records/fields from two work areas
------------------------------------------------------------------------------
 Syntax

     JOIN WITH <xcAlias> TO <xcDatabase>
        FOR <lCondition> [FIELDS <idField list>]

 Arguments

     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
     parentheses.

     FOR <lCondition> selects only records meeting the specified
     condition.

     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.

 Description

     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
     source files.

     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.

 Examples

     .  This example joins Customer.dbf to Invoices.dbf to produce
        Purchases.dbf:

        USE Invoices NEW
        USE Customers NEW
        JOIN WITH Invoices TO Purchases;
           FOR Last = Invoices->Last;
           FIELDS First, Last, Invoices->Number, ;
              Invoices->Amount

 Files   Library is CLIPPER.LIB.

See Also: SET RELATION



Advertisements

3 responses to “C5_JOIN

  1. Pingback: C5_UPDATE | Viva Clipper !

  2. Pingback: DB Commands | Viva Clipper !

  3. Pingback: C5 Commands | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.