Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get top 100 records?
Message
De
25/08/2006 17:32:44
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
 
À
25/08/2006 17:09:23
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01148703
Message ID:
01148732
Vues:
13
>I don't normally use rowcount, but i think this will work:
>
>set rowcount 100
>select age, name from persons order by age desc
>
>
>>I need a way to get the top 100 records without using LIMIT or TOP...
>>
>>something like this:
>>create table person(name varchar(30), age int);
>>
>>...and I need just the 100 oldest people... anyone know how to do this?
>>
>>Thanks!

Yup, this is the answer to the trick question. In a recent job interview I was asked a similar trick question. The interviewer had one of those 'interview question cheat sheets' that he downloaded from somewhere. It's a question that is completely irrelavent to any real-world scenario. Of course, I came up with an answer that didn't use rowcount, so the interviewer refined the question to exclude the answer I had given. After two more answer/refine question iterations I was livid and almost walked out of the interview.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform