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.
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.
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: