G
Guest
How can I pull every 5th line out of my database table and place into a new
table?
table?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.

ChrisM said:OK,
The simplest way to do this is to add a new field to your table called
somthing like RecordNumber.
Make it of type AutoNumber, then every time you add a new record, it will
automatically be allocated a sequential number.
Then it will be quite easy to do what you want:
SELECT * FROM MyTable
WHERE
[RecordNumber]/5-Int([RecordNumber]/5)=0;
-- Might well be a better way than this, but can't think just now. Too late
on a Friday afternoon...![]()
KARL DEWEY said:Another way is following ChrisM's advice like this --
SELECT * FROM MyTable
WHERE
[RecordNumber] Mod 5=0;
ChrisM said:OK,
The simplest way to do this is to add a new field to your table called
somthing like RecordNumber.
Make it of type AutoNumber, then every time you add a new record, it will
automatically be allocated a sequential number.
Then it will be quite easy to do what you want:
SELECT * FROM MyTable
WHERE
[RecordNumber]/5-Int([RecordNumber]/5)=0;
-- Might well be a better way than this, but can't think just now. Too late
on a Friday afternoon...
Tom said:I have 10 fields in all field. They are in order lastname, firstname, case
Number, dos,units, facility, provider, rem source, ref number,. when we go
out to do an audit of records we pull every 5th record.
--
Tom
:
Tom,
Could you give an example of the data that you have, showing the way it
is
sorted, and the way you want these rows extracted.
Thanks,
Chris.
Yes I have sorded the records on field 8. I do not have a primary key.
How
would I apply a formula to field 1?
--
Tom
:
Your table should really be sorted on a field first, otherwise, there
is
no
guarantee of the order that the records will be retrieved from the
table.
What is your primary key if one is defined? and is there any way you
can
apply a formula to this field to accomplish your goal?
How can I pull every 5th line out of my database table and place
into a
new
table?
Tom said:That works great.. Now I need to add one more thing into the mix, in the
field were the provider is, if they have provided less than 25 services i
need it to show all of them.
--
Tom
KARL DEWEY said:Another way is following ChrisM's advice like this --
SELECT * FROM MyTable
WHERE
[RecordNumber] Mod 5=0;
ChrisM said:OK,
The simplest way to do this is to add a new field to your table called
somthing like RecordNumber.
Make it of type AutoNumber, then every time you add a new record, it will
automatically be allocated a sequential number.
Then it will be quite easy to do what you want:
SELECT * FROM MyTable
WHERE
[RecordNumber]/5-Int([RecordNumber]/5)=0;
-- Might well be a better way than this, but can't think just now. Too late
on a Friday afternoon...
I have 10 fields in all field. They are in order lastname, firstname, case
Number, dos,units, facility, provider, rem source, ref number,. when we go
out to do an audit of records we pull every 5th record.
--
Tom
:
Tom,
Could you give an example of the data that you have, showing the way it
is
sorted, and the way you want these rows extracted.
Thanks,
Chris.
Yes I have sorded the records on field 8. I do not have a primary key.
How
would I apply a formula to field 1?
--
Tom
:
Your table should really be sorted on a field first, otherwise, there
is
no
guarantee of the order that the records will be retrieved from the
table.
What is your primary key if one is defined? and is there any way you
can
apply a formula to this field to accomplish your goal?
How can I pull every 5th line out of my database table and place
into a
new
table?
KARL DEWEY said:Who is they? Who are you auditing? lastname, dos, units, facility,
provider, rem source?
You will need another query to pull that information.
What do you need to show all - all records or all [fill in the blank] that
have provided less than 25 services?
Tom said:That works great.. Now I need to add one more thing into the mix, in the
field were the provider is, if they have provided less than 25 services i
need it to show all of them.
--
Tom
KARL DEWEY said:Another way is following ChrisM's advice like this --
SELECT * FROM MyTable
WHERE
[RecordNumber] Mod 5=0;
:
OK,
The simplest way to do this is to add a new field to your table called
somthing like RecordNumber.
Make it of type AutoNumber, then every time you add a new record, it will
automatically be allocated a sequential number.
Then it will be quite easy to do what you want:
SELECT * FROM MyTable
WHERE
[RecordNumber]/5-Int([RecordNumber]/5)=0;
-- Might well be a better way than this, but can't think just now. Too late
on a Friday afternoon...
I have 10 fields in all field. They are in order lastname, firstname, case
Number, dos,units, facility, provider, rem source, ref number,. when we go
out to do an audit of records we pull every 5th record.
--
Tom
:
Tom,
Could you give an example of the data that you have, showing the way it
is
sorted, and the way you want these rows extracted.
Thanks,
Chris.
Yes I have sorded the records on field 8. I do not have a primary key.
How
would I apply a formula to field 1?
--
Tom
:
Your table should really be sorted on a field first, otherwise, there
is
no
guarantee of the order that the records will be retrieved from the
table.
What is your primary key if one is defined? and is there any way you
can
apply a formula to this field to accomplish your goal?
How can I pull every 5th line out of my database table and place
into a
new
table?
Tom said:We have people that provide service to clients, we audit there medical record
to make sure every thing is there and in the right order. if a provider had
less than 25 services that he or she provided we audit all of there records.
Need to show all that have provided less than 25 services.
--
Tom
KARL DEWEY said:Who is they? Who are you auditing? lastname, dos, units, facility,if they have provided less than 25 services
provider, rem source?
You will need another query to pull that information.
What do you need to show all - all records or all [fill in the blank] thatneed it to show all of them.
have provided less than 25 services?
Tom said:That works great.. Now I need to add one more thing into the mix, in the
field were the provider is, if they have provided less than 25 services i
need it to show all of them.
--
Tom
:
Another way is following ChrisM's advice like this --
SELECT * FROM MyTable
WHERE
[RecordNumber] Mod 5=0;
:
OK,
The simplest way to do this is to add a new field to your table called
somthing like RecordNumber.
Make it of type AutoNumber, then every time you add a new record, it will
automatically be allocated a sequential number.
Then it will be quite easy to do what you want:
SELECT * FROM MyTable
WHERE
[RecordNumber]/5-Int([RecordNumber]/5)=0;
-- Might well be a better way than this, but can't think just now. Too late
on a Friday afternoon...
I have 10 fields in all field. They are in order lastname, firstname, case
Number, dos,units, facility, provider, rem source, ref number,. when we go
out to do an audit of records we pull every 5th record.
--
Tom
:
Tom,
Could you give an example of the data that you have, showing the way it
is
sorted, and the way you want these rows extracted.
Thanks,
Chris.
Yes I have sorded the records on field 8. I do not have a primary key.
How
would I apply a formula to field 1?
--
Tom
:
Your table should really be sorted on a field first, otherwise, there
is
no
guarantee of the order that the records will be retrieved from the
table.
What is your primary key if one is defined? and is there any way you
can
apply a formula to this field to accomplish your goal?
How can I pull every 5th line out of my database table and place
into a
new
table?
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.