Sql updating a row
SET column_name = (subquery3) Assigns the value retrieved from the database by list.
The subquery must return exactly one row that includes all the columns listed.
Syntax update statement ::= Description of the illustration update_Keyword and Parameter Description alias Another (usually short) name for the referenced table or view, typically used in the contains references to columns in the table being updated, the references are resolved in the context of the current row.
The old column values are used on the right side of the equal sign.
I was not able, using my SQL 4.1.1, to do this as a subquery: UPDATE Groups LEFT JOIN (SELECT Group Id, MIN(Val Within Group) AS base Val FROM Groups GROUP BY Group Id) AS Grp Sum USING (Group Id) SET Val Within Group=Val Within Group-base Val; Csaba Gabor UPDATE Syntax with "on-line" updating value limitations.
I had a problem - a had to update a column "rate" but if the existince or new value is greater then 5 this "5" will be finally value in field.2 | 22 from 01 08 2003 / 23 from 02 08 2003 / | | 3 |