Difference between revisions of "UPDATE"

From Recital Documentation Wiki
Jump to: navigation, search
Line 1: Line 1:
=UPDATE=
 
 
 
 
==Class==
 
==Class==
 
Fields and Records
 
Fields and Records
Line 19: Line 16:
  
 
==See Also==
 
==See Also==
[[AVERAGE]], [[COUNT]], [[SUM]], [[TOTAL]], [[SET FILTER]], [[SET RELATION]]
+
[[AVERAGE]], [[COUNT]], [[SET FILTER]], [[SET RELATION]], [[SUM]], [[TOTAL]]
  
  
Line 35: Line 32:
 
use patrons index names, events, dates
 
use patrons index names, events, dates
 
update on name from new;
 
update on name from new;
replace balance with balance + new->balance
+
  replace balance with balance + new->balance
 
</code>
 
</code>
  

Revision as of 11:49, 26 May 2009

Class

Fields and Records


Purpose

Update the contents of the active table with data from another table


Syntax

UPDATE ON <key expression> FROM <workarea | alias>

REPLACE <field> WITH <exp> [,<field> WITH <exp>...]

[RANDOM]


See Also

AVERAGE, COUNT, SET FILTER, SET RELATION, SUM, TOTAL


Description

The UPDATE command updates fields in the active table based upon data from another table. The <key expression> must exist in both tables. The active table must be indexed on the specified <key expression> unless the RANDOM keyword is specified. The FROM table can be in any order. If a FILTER <condition> is active in the FROM workarea, then only those records which satisfy the <condition> are processed. If SET DELETED is ON, then records which are marked for deletion in the FROM workarea are not processed.

It is strongly recommended that the active table be indexed on the <key expression>, otherwise ALL records satisfying the <key expression> values in the FROM file are updated in the active table, which can be a lengthy process. The UPDATE command is primarily used to update a 'master' file from records held in a 'transaction' file.


Example

select b
use newpatrons alias new
select a
use patrons index names, events, dates
update on name from new;
  replace balance with balance + new->balance


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer