I need to return a row:
.NET[tableReturn] = select top(1) * from [table] where x = 0 order by desc
but at the same time I need to update it:
update [table] set x = 1 where [id] = .NET[tableReturn].[id]
and need all data of this row
It is possible in the same query?
Resolve this!
DECLARE @id int;
SET @id = (select top(1) id from [table] where [x] = 0 order by id desc);
select * from [table] where id = @id;
update [table] set [x] = 20 where id = @id;
:D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With