Sort by position of edited record (sql server)

0

When I enter a new record, I sort it by the last record entered.

SELECT TOP(50) * FROM TB_CLIENTE_FORNECEDOR where status <> 'S' order by IDCLIENTEFORNECEDOR desc

If I'm editing a record whose id is 10, I want to sort by this id.

    
asked by anonymous 11.10.2015 / 02:49

1 answer

0

Specify the value of ID as part of your query, and use Minor or Equal to operator ( <= ):

SELECT TOP(50) * 
FROM   tb_cliente_fornecedor 
WHERE  status <> 'S' 
  AND  idclientefornecedor <= 10
ORDER  BY idclientefornecedor DESC 

Reference:

link

    
11.10.2015 / 03:17