By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,486 Members | 2,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,486 IT Pros & Developers. It's quick & easy.

Help me in selecting first n records from a table by SELECT Query

P: 9
Dears

1- I want to make a query to select first n records from a table. The table has no field like autonumber.

2- How can I use a variable in query. for example

n=100 n is a variable

SELECT * FROM table WHERE numericfield>n
Feb 3 '08 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,597
Dears

1- I want to make a query to select first n records from a table. The table has no field like autonumber.

2- How can I use a variable in query. for example

n=100 n is a variable

SELECT * FROM table WHERE numericfield>n
SQL to Select the first n Employees (ALL Fields):
Expand|Select|Wrap|Line Numbers
  1. Dim n As Integer
  2.  
  3. n = 100
  4.  
  5. SQL ==>  "SELECT TOP " & n & " Employees.* FROM Employees;"
Feb 3 '08 #2

P: 9
SQL to Select the first n Employees (ALL Fields):
Expand|Select|Wrap|Line Numbers
  1. Dim n As Integer
  2.  
  3. n = 100
  4.  
  5. SQL ==>  "SELECT TOP " & n & " Employees.* FROM Employees;"
Thanks a lot for helping me.
Feb 4 '08 #3

ADezii
Expert 5K+
P: 8,597
Thanks a lot for helping me.
You are quite welcome.
Feb 4 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.