I'm looking for something similar this in SQL Server:
SELECT TOP n WITH TIES FROM tablename
I know about LIMIT
in PostgreSQL, but does the equivalent of the above exist? I'm just curious as it would save an extra query each time for me.
If I have a table Numbers
with attribute nums
: {10, 9, 8, 8, 2}
. I want to do something like:
SELECT nums FROM Numbers ORDER BY nums DESC LIMIT *with ties* 3
It should return {10, 9, 8, 8}
because it takes the top 3 plus the extra 8
since it ties the other one.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…