Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting specific row

Status
Not open for further replies.

IANGRAND

Technical User
Jul 29, 2003
92
GB
I am running the following SQL code, to select a row in the Table HOURLY_AVERAGE. I need to select the row relevant to the number stored in Textbox163.

However the SQL code, does not work.....any ideas?

SELECT TOP 1 *
FROM [Select top [Text163] * from HOURLY_AVERAGE order by AvgOfNO2 desc]. AS T1
ORDER BY AvgOfNO2;

Cheers

Ian Grand
 
Hi, logically you are always going to get the same row returned using TOP. If I have a table of 1,000 records and ask for the top 1 of the top 10 I'll get the same answer as if I ask for the top 1 of the top 999 - even if that record is actually held as the 1,000th observation or row in that table.

If, on the other hand, you want to see the 375th record of that table - well personally I only know how to do that using a recordset in VBA...

HTH, Jamie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top