
20/05/2008, 11:15
|
 | | | Fecha de Ingreso: agosto-2007 Ubicación: Tapachula
Mensajes: 1.218
Antigüedad: 17 años, 6 meses Puntos: 20 | |
Respuesta: SQL: Actualizar registros a partir de otra tabla... Checa estos dos ejemplos Cita: Increment the sales count of the salesperson who manages the account for Acme Corporation, using the FROM clause syntax:
UPDATE employees SET sales_count = sales_count + 1 FROM accounts
WHERE accounts.name = 'Acme Corporation'
AND employees.id = accounts.sales_person;
Perform the same operation, using a sub-select in the WHERE clause:
UPDATE employees SET sales_count = sales_count + 1 WHERE id =
(SELECT sales_person FROM accounts WHERE name = 'Acme Corporation'); |