Sunday, July 8, 2012

Update Where Select Affecting Only First Found Row

The UPDATE statement allows you to update a single record or multiple records in a table, in this case below you want to update with the same table where you want the first stat found will update




Here’s the SQL Query update table_cust set Stock = 0, stat=2 where Code_data = (select TOP 1 (code_data) from tb_cust where stat = 1 order by date_in).


http://www.gokhiel.com/2012/07/update-where-select-affecting-only.html

No comments:

Post a Comment