Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>join</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
JOIN


Syntax:     JOIN WITH <alias>/(<expC1>) TO <file>/(<expC2>) FOR
            <condition> [FIELDS <field list>]

Purpose:    To create a new database file by merging selected records
            and fields from two work areas.

Arguments:  <alias> is the work area to merge with records from the
            current work area.

            <file> is the name of the target database file.

Options:    For: The FOR <condition> selects only records meeting
            the specified condition.

            Fields: The <field 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.

Usage:      JOIN is a projection of fields and a selection of records
            from two work areas that forms a new database file 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
            processed in the secondary work area.  When the condition is
            true (.T.), a new record is created in the target database
            file.

            Note that the number of records processed will be the
            RECCOUNT() of the primary work area times the RECCOUNT() 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.  All of which
            necessitates the maxim, "use this command with prudence."

Library:    CLIPPER.LIB


----------------------------------- Example --------------------------------

   The following example JOINs the Customer database file to the
   Invoices database file to produce a database file of Purchases:

   USE Customers
   SELECT 2
   USE Invoices
   SELECT 1

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


See Also: APPEND FROM REPLACE SET RELATION

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson