Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default SQL string to return top row

Hi Quartz,

You can use the TOP n expression to do that. Basically, the database will
return the top n row(s) that meet the criteria. For example, if you wanted
the top 5 records from a table named tblEmployees where the employee's last
name starts with "S", you would do this:

SELECT TOP 5 *
FROM tblEmployees
WHERE LastName LIKE 'S*'
ORDER BY LastName ASC

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Quartz wrote:
Hello, please help if possible.

Does anyone know what the SQL string would look like to
return ALL columns for a specific number of rows (or just
the top row) of an Access DB (along with the headers)?

I've tried things like:

SELECT * FROM [TABLE] WHERE ROWNUM = 1;

but Access apparently doesn't use "ROWNUM".

Your example string would be most helpful. TIA.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return a String in a 7 Row Range Q Sean Excel Worksheet Functions 6 October 6th 08 03:36 PM
return first TWO or THREE words in string EngelseBoer Excel Discussion (Misc queries) 10 September 7th 08 04:51 PM
return 1st word in string EngelseBoer Excel Discussion (Misc queries) 6 September 7th 08 11:25 AM
return an empty string in VBA Dave F[_2_] Excel Discussion (Misc queries) 13 August 7th 07 05:59 PM
return partial string alex Excel Worksheet Functions 5 July 20th 07 11:41 AM


All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"