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

Come posso cercare righe attorno a un determinato valore di stringa?

SELECT TOP 11 * FROM MyTable WHERE identifier >= 'My Value' ORDER BY identifier ASC
UNION ALL
SELECT TOP 10 * FROM MyTable WHERE identifier < 'My Value' ORDER BY identifier DESC