Make new table increment 1,3,5

  • Thread starter Thread starter Garry
  • Start date Start date
G

Garry

Hi all,
I am making a new table from a query O.K.

Upon running can I input the number of records I wish to be copied (say
first 500).

At the same time can I increment a URN say 1,3,5 or 2,4,6 etc

thanks in advance Garry
 
Upon running can I input the number of records I wish to be copied (say
first 500).
Two ways to do it. In query design view edit the icon that says "All" to
read 500. The other way does the same thing in SQL view edit the SQL
statement.
If it reads like this --
SELECT tblXYZ.ABC, tblXYZ.QRS,
Change it to this --
SELECT TOP 500 tblXYZ.ABC, tblXYZ.QRS,
What is a "URN"?
 
Hi Garry,

For incrementing by 2, you can use a subquery. Here's an example that
works in the Northwind sample database to number the returned records
1,3,5... For 2,4,6... change "<" to "<=" and omit the "+ 1".

SELECT
((
SELECT COUNT(CustomerID)
FROM Customers AS B
WHERE B.CustomerID < A.CustomerID
) * 2 + 1) AS Seq,
A.CustomerID,
A.CompanyName
FROM Customers AS A
ORDER BY A.CompanyName;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top