473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Every n-th record in a selection

WINDOWS XP, Access 2003
I have a query that lists certain amounts as follows

Select a,b,c, amount
from table
ordered by amount.

Now i've been asked to produce a list of every n-th record in that list (preferably in such a way as to be able to reproduce the selection identically to previous selections, also n should be entered manually).

Any suggestions as how to do this ?
May 11 '07 #1
4 2555
JConsulting
603 Expert 512MB
WINDOWS XP, Access 2003
I have a query that lists certain amounts as follows

Select a,b,c, amount
from table
ordered by amount.

Now i've been asked to produce a list of every n-th record in that list (preferably in such a way as to be able to reproduce the selection identically to previous selections, also n should be entered manually).

Any suggestions as how to do this ?
Expand|Select|Wrap|Line Numbers
  1. SELECT a,b,c, amount
  2. FROM Table
  3. WHERE ((([myindex]-1) Mod [enter Nth]=0));
  4.  
May 12 '07 #2
Expand|Select|Wrap|Line Numbers
  1. SELECT a,b,c, amount
  2. FROM Table
  3. WHERE ((([myindex]-1) Mod [enter Nth]=0));
  4.  
Thank you for this solution.
My problem being that there is not really an index since the fields need to be ordered by a series of other fields (i failed to mention this in the initial question, a,b and c).

I gues I'll just have to create an index unless someone has another solution.
May 14 '07 #3
NeoPa
32,556 Expert Mod 16PB
The only solution I can think of is to process through the recordset in code. Unfortunately, this cannot be used as the Record Source for objects like forms or reports.
Essentially, an RDBMS is designed to treat each record as a unique item and so the idea of ordinal numbers (1st; 2nd; 3rd; 4th; etc), or anything that is positionally relative is anathema (It doesn't make sense within that scenario).
Sometimes, tricks can be used to imitate what's required, but I can't see a useful one here.
May 17 '07 #4
JConsulting
603 Expert 512MB
The only solution I can think of is to process through the recordset in code. Unfortunately, this cannot be used as the Record Source for objects like forms or reports.
Essentially, an RDBMS is designed to treat each record as a unique item and so the idea of ordinal numbers (1st; 2nd; 3rd; 4th; etc), or anything that is positionally relative is anathema (It doesn't make sense within that scenario).
Sometimes, tricks can be used to imitate what's required, but I can't see a useful one here.
>>The only solution I can think of is to process through the recordset in code

If a temp table was used to store every nth record while cycling through a recordset, then that could be used as the source for a form or report.

J
May 17 '07 #5

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

Similar topics

7
by: Henry Hartley | last post by:
I've got a PHP system working on a development server (Windows 2000/IIS5/PHP 4.3.3) but it doesn't seem to be working quite right on the testing server (same except PHP 4.2.3). I upgraded the PHP...
8
by: pigeon | last post by:
I have 2 users that their client software must be going crazy.. they are sending packets every .02 seconds to the db server... I know this because I stuck a sniffer on teh traffic.. but now i just...
11
by: The Bicycling Guitarist | last post by:
Oh lords and ladies of ciwah, I have already been told by one person that the <h1> on my home page doesn't look like proper semantic markup to them. That person suggested a <p> with style by CSS....
0
by: Open Minded111 | last post by:
***this isn't spam. I am actually just a dude who wrote an ebook and i want to share it with as many people as might benefit from it. I come in peace!*** Its well known that the path to...
1
by: Steve Jacobs | last post by:
Hi, I need to run a vb.net or aspx.net file every 10 seconds. The Task Scheduler in Windows 2003 Server can only do it every 1 minute at the minimum, but I need it every 10 seconds. Is it...
3
by: Dave | last post by:
Hey all, I have a problem and I can't find anything on the net to really address it. We have a program at work that has lots of numbers on the front of the form because it is a control program...
7
by: rahismailbox | last post by:
I need to run a script in every 10 seconds in background of the site of 10-15 php pages. So how do i activate that script? Is there a code to be embedded in every php page so that the script got...
0
by: alivip | last post by:
I write code to get most frequent words in the file I won't to implement bigram probability by modifying the code to do the following: How can I get every Token (word) and ...
8
by: ShadowLocke | last post by:
Hi, I have an HTML button that i want to execute javascript on every mouse down that occurs. I'v tried using the onmousedown and the onclick events but the button only executes on every second...
4
by: Frank Lund | last post by:
Should we call .Dispose() every chance we get... on every object that exposes .Dispose()... and every time we have such an object? For example, is it true that *every* time I create a DataTable...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.