Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Come aggiornare e ordinare utilizzando ms sql

WITH    q AS
        (
        SELECT  TOP 10 *
        FROM    messages
        WHERE   status = 0
        ORDER BY
                priority DESC
        )
UPDATE  q
SET     status = 10