Click to See Complete Forum and Search --> : How to SELECT top 5 enteries using SQL commend?


austin
01-28-2005, 01:50 AM
hai every one

i donot know this is the right forum to ask a SQL related question but certainly my many doubts were cleared out here so hopfully i will get an answer........this time also
so my question is

How can we select the Top ( maximum ) 5 values form a table just makeing use of sql query.....?

thanks in advance...

keep smiling
austin

PeOfEo
01-28-2005, 05:57 PM
dataset.tables("table").rows.count will get you the number of rows in a dataset. But I am not sure how you would do it with a db without using some sort of stored procedure. If you have a fixed number of enties in the db this would bhe very easy to do, but I am assuming this is variable. How many entries are we talking about? If it is not a huge number you might just put them into a dataset and write them out from that.

austin
01-28-2005, 11:31 PM
SELECT TOP 10 * FROM TABLE1;

10 IS THE NO OF ROWS
TABLE1 IS THE TABLE NAME

THANKS

PeOfEo
01-28-2005, 11:33 PM
Good to know.