Make new table increment 1,3,5

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
 
K

KARL DEWEY

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"?
 
J

John Nurick

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;
 
Top