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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to insert every 12th row into a new table

Status
Not open for further replies.

paulfla

Programmer
Apr 22, 2002
29
US
My SQL knowledge is limited so please be patient with me.

I have a table with 4000+ rows in it. I need to extract every 12th row from the table and insert it into a new table. Can you please tell me how to do this?

Thanks in advance for your time.
Paul
 
The only way i would know, is a bit more long winded, but will work.

I would do a simple form, then have a procedure that then takes the first record, then every 12th records after and using a append query, update a table with what is displayed on the form.

It should happen so fast, you will not see it happening...

Sorry i can not offer a shorter answer...

Or if you like copy and paste, but it may take you some time...
 
I know it looks like a table to you but SQL sees it as a relation. The relational model explictly bans concepts like "every 12th row".

Firstly write a query with an ORDER BY clause that presents the data so the rows are still in the order you want them. If that hasn't ruined everything, think next how you are going to ask SQL to pick out your rows - what data characteristics mark them out

If you are stumped, post your logic (in English) here and someone will help.

You can of course treat Jet as an ordinary file system and write some VBA to pick rows physically, but that is missing the point.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top