xHarbour Reference Documentation > Command Reference |
Updates records in the current work area from a second work area.
UPDATE FROM <cAlias> ON <expression> ; [RANDOM] ; REPLACE <fieldName1> WITH <value1> ; [,<fieldNameN> WITH <valueN> ]
The UPDATE command replaces fields in the current work area with values from a second work area based on <expression>. An update occurs when <expression> provides the same value in both work areas. This requires the current work area be indexed on <expression> and that no multiple key values exist in this index. When there are multiple records with the same key value, only the first record with this key value is updated. The FROM work area, however, can have duplicate key values.
If RANDOM is not specified both work areas must be indexed on <expression>. If RANDOM is specified, only the current work area needs to be indexed on <expression>.
In a multi-user application in network operation, the file in the current work area must be exclusively open or a file lock with FLock() must be applied.
Records marked for deletion are not processed in either work area when SET DELETED is set to ON.
See also: | AVERAGE, DbEval(), INDEX, OrdCreate(), REPLACE, SORT, SUM, TOTAL |
Category: | Database commands |
Source: | rdd\dbcmd.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
http://www.xHarbour.com