I have a query that outputs "student name" and "entry#" Entry# are in
ascending order. Some students may only have 1 entry# or multiple entry#'s
depending on how many routines they are in.
What I need to be able to do is calculate the difference between studen'ts
entry#'s and see if they have at least 5 entries between them.
Is this possible?
|
|
0
|
|
|
|
Reply
|
Utf
|
3/1/2010 2:58:01 AM |
|
Not sure that I'm understanding this correctly - to me, "difference" implies
a mathematical calculation (subtraction). But if what you're wanting to get
is a list of student names for student with at least 5 entry# records, use a
totals query:
SELECT [Student Name], Count([Entry#]) AS [CountOfEntry#]
FROM YourTableName
GROUP BY [Student Name]
HAVING (Count([Entry#]) >= 5;
To do this in the query design grid, add the "Student Name" and "entry#"
fields, then click the totals symbol (Greek sigma, like a W on its side).
In the Total row which then appears in the grid, select Group By for Student
Name and Count for entry#; put >= 5 in the criteria row for entry#.
BTW, including spaces and/or symbols such as # in your field names will
force you to enclose those names in square brackets when you refer to them;
it is neither standard practice nor good practice.
HTH,
Rob
"S" <S@discussions.microsoft.com> wrote in message
news:50AEB1C9-66DB-47E2-8519-45B865C54D27@microsoft.com...
>I have a query that outputs "student name" and "entry#" Entry# are in
> ascending order. Some students may only have 1 entry# or multiple
> entry#'s
> depending on how many routines they are in.
>
> What I need to be able to do is calculate the difference between studen'ts
> entry#'s and see if they have at least 5 entries between them.
>
> Is this possible?
|
|
0
|
|
|
|
Reply
|
Rob
|
3/1/2010 3:54:38 AM
|
|
Let me give an example to better show what I am lookinf for...
StudentName Entry#
John Doe 001
John Doe 015
John Doe 019
John Doe 045
So I am looking for a query to calculate how many entries are inbetween each
entry for each student
So John Doe is entry# 001, then 015 (so theres 14 entries inbetween) then
from entry 015 to 019 (theres 4 entries) then from 019 to 045 (26 entries)
I only need to know when there is less than 5 entries.
SO the query result I am looking for is:
John Doe 015 019 less than 5 entries
"Rob Parker" wrote:
> Not sure that I'm understanding this correctly - to me, "difference" implies
> a mathematical calculation (subtraction). But if what you're wanting to get
> is a list of student names for student with at least 5 entry# records, use a
> totals query:
>
> SELECT [Student Name], Count([Entry#]) AS [CountOfEntry#]
> FROM YourTableName
> GROUP BY [Student Name]
> HAVING (Count([Entry#]) >= 5;
>
> To do this in the query design grid, add the "Student Name" and "entry#"
> fields, then click the totals symbol (Greek sigma, like a W on its side).
> In the Total row which then appears in the grid, select Group By for Student
> Name and Count for entry#; put >= 5 in the criteria row for entry#.
>
> BTW, including spaces and/or symbols such as # in your field names will
> force you to enclose those names in square brackets when you refer to them;
> it is neither standard practice nor good practice.
>
> HTH,
>
> Rob
>
>
> "S" <S@discussions.microsoft.com> wrote in message
> news:50AEB1C9-66DB-47E2-8519-45B865C54D27@microsoft.com...
> >I have a query that outputs "student name" and "entry#" Entry# are in
> > ascending order. Some students may only have 1 entry# or multiple
> > entry#'s
> > depending on how many routines they are in.
> >
> > What I need to be able to do is calculate the difference between studen'ts
> > entry#'s and see if they have at least 5 entries between them.
> >
> > Is this possible?
>
> .
>
|
|
0
|
|
|
|
Reply
|
Utf
|
3/1/2010 1:48:01 PM
|
|
Your question is not clear.
It might help to post a few sample records and the desired outcome. Also,
post the actual field names and data types and your table name.
I think you want to determine the difference between successive entry numbers
per student. Generically, you might be able to use a query that looks like
the following. It uses a correlated sub-query to get the prior entry number
and then does the math. Of course if entry number is not a number field then
this will fail to give you the correct results or it will error.
SELECT [StudentName], [EntryNumber]
, [EntryNumber] - (SELECT Max([EntryNumber])
FROM [TABLE] as TEMP
WHERE TEMP.[EntryNumber] < ]Table].[EntryNumber]
AND TEMP.[StudentName] = [Table].[StudentName])
as TheDifference
FROM [TABLE]
You need to replace the table and field names with your table and field names.
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
S wrote:
> I have a query that outputs "student name" and "entry#" Entry# are in
> ascending order. Some students may only have 1 entry# or multiple entry#'s
> depending on how many routines they are in.
>
> What I need to be able to do is calculate the difference between studen'ts
> entry#'s and see if they have at least 5 entries between them.
>
> Is this possible?
|
|
0
|
|
|
|
Reply
|
John
|
3/1/2010 2:13:12 PM
|
|
My Table is "Dancers For Each Routine"
Fields Are:
ID (AutoNumber)
Dancer ID (Number)
Entry ID (Number)
Sample records are
Dancer ID Entry ID
5 17
5 45
5 52
5 54
7 10
7 73
7 80
You are correct. I am looking for the difference between successive entry
numbers
per student.
So the difference for Dancer ID 5 records would be
Dancer ID Entry ID TheDiffernce
5 17
5 45 28
5 52 7
5 56 4
7 10
7 73 63
7 80 7
I would only need the following outcome
Dancer ID 5 has less than 5 numbers from enrty id 52 and entry id 56.
I treid what you gave my and I'm not getting those results. A lot of
positive and negative numbers.
"John Spencer" wrote:
> Your question is not clear.
>
> It might help to post a few sample records and the desired outcome. Also,
> post the actual field names and data types and your table name.
>
> I think you want to determine the difference between successive entry numbers
> per student. Generically, you might be able to use a query that looks like
> the following. It uses a correlated sub-query to get the prior entry number
> and then does the math. Of course if entry number is not a number field then
> this will fail to give you the correct results or it will error.
>
> SELECT [StudentName], [EntryNumber]
> , [EntryNumber] - (SELECT Max([EntryNumber])
> FROM [TABLE] as TEMP
> WHERE TEMP.[EntryNumber] < ]Table].[EntryNumber]
> AND TEMP.[StudentName] = [Table].[StudentName])
> as TheDifference
> FROM [TABLE]
>
> You need to replace the table and field names with your table and field names.
>
> John Spencer
> Access MVP 2002-2005, 2007-2010
> The Hilltop Institute
> University of Maryland Baltimore County
>
> S wrote:
> > I have a query that outputs "student name" and "entry#" Entry# are in
> > ascending order. Some students may only have 1 entry# or multiple entry#'s
> > depending on how many routines they are in.
> >
> > What I need to be able to do is calculate the difference between studen'ts
> > entry#'s and see if they have at least 5 entries between them.
> >
> > Is this possible?
> .
>
|
|
0
|
|
|
|
Reply
|
Utf
|
3/1/2010 7:07:01 PM
|
|
I mistyped something. Got it working great!
Thank you
"S" wrote:
> My Table is "Dancers For Each Routine"
> Fields Are:
> ID (AutoNumber)
> Dancer ID (Number)
> Entry ID (Number)
>
> Sample records are
> Dancer ID Entry ID
> 5 17
> 5 45
> 5 52
> 5 54
> 7 10
> 7 73
> 7 80
>
> You are correct. I am looking for the difference between successive entry
> numbers
> per student.
>
> So the difference for Dancer ID 5 records would be
> Dancer ID Entry ID TheDiffernce
> 5 17
> 5 45 28
> 5 52 7
> 5 56 4
> 7 10
> 7 73 63
> 7 80 7
>
>
> I would only need the following outcome
> Dancer ID 5 has less than 5 numbers from enrty id 52 and entry id 56.
>
> I treid what you gave my and I'm not getting those results. A lot of
> positive and negative numbers.
>
>
>
>
> "John Spencer" wrote:
>
> > Your question is not clear.
> >
> > It might help to post a few sample records and the desired outcome. Also,
> > post the actual field names and data types and your table name.
> >
> > I think you want to determine the difference between successive entry numbers
> > per student. Generically, you might be able to use a query that looks like
> > the following. It uses a correlated sub-query to get the prior entry number
> > and then does the math. Of course if entry number is not a number field then
> > this will fail to give you the correct results or it will error.
> >
> > SELECT [StudentName], [EntryNumber]
> > , [EntryNumber] - (SELECT Max([EntryNumber])
> > FROM [TABLE] as TEMP
> > WHERE TEMP.[EntryNumber] < ]Table].[EntryNumber]
> > AND TEMP.[StudentName] = [Table].[StudentName])
> > as TheDifference
> > FROM [TABLE]
> >
> > You need to replace the table and field names with your table and field names.
> >
> > John Spencer
> > Access MVP 2002-2005, 2007-2010
> > The Hilltop Institute
> > University of Maryland Baltimore County
> >
> > S wrote:
> > > I have a query that outputs "student name" and "entry#" Entry# are in
> > > ascending order. Some students may only have 1 entry# or multiple entry#'s
> > > depending on how many routines they are in.
> > >
> > > What I need to be able to do is calculate the difference between studen'ts
> > > entry#'s and see if they have at least 5 entries between them.
> > >
> > > Is this possible?
> > .
> >
|
|
0
|
|
|
|
Reply
|
Utf
|
3/1/2010 8:49:01 PM
|
|
|
5 Replies
202 Views
(page loaded in 1.048 seconds)
Similiar Articles: Difference between two numbers - microsoft.public.excel.worksheet ...I have two columns, each with numbers in them. All I want to do if find the difference between these two numbers. Don't want whether negative or po... Calculate Difference in Rows - microsoft.public.accessHow do I calculate the difference between two numbers in different rows? ... Percentage between two numbers - microsoft.public.excel.misc ...... is the formulas i used: > >> > =(B1-A1)/ABS(A1) > >> > =(B2-A2)/ABS(A2) > >> > I need a formula to calculate the percentage of differences between two > >> > numbers ... Enter Match Invoice - Receipt Nmbr vs Voucher Nmbr - microsoft ...Enter Match Invoice - Receipt Nmbr vs Voucher Nmbr - microsoft ... Difference between two numbers - microsoft.public.excel.worksheet ... Enter Match Invoice - Receipt Nmbr ... Difference between two date/time values - microsoft.public.excel ...Difference between two date/time values - microsoft.public.excel ... All I want to do if find the difference between these two numbers. Don't want whether negative ... Trying to calculate difference between two times in an access repo ...Trying to calculate difference between two times in an access repo ... Trying to calculate difference between two times in an access repo ... Calculate the number of ... How to calculate diffrence between two dates - microsoft.public ...How to Calculate the Difference Between Dates | eHow.com Often times, people want to know the exact number of days they have until a particular event occurs. running difference between adjacent records in report - microsoft ...I need to calculate the difference between the end of process 1 and the beginning of ... In the Format event procedure of the Detail section, assign the number minutes ... Calculate the number of seconds between two times - microsoft ...Calculate the number of seconds between two times - microsoft ... Calculate the difference between two times - Excel - Office.com On the Home tab, in the Number group ... equations - can I italicize the numbers - microsoft.public.word ...Mathematics Question: How To Calculate The Percentage Difference Between Two Numbers? Mathematical equations can sometimes prove difficult to execute. How do i calculate the percentage difference between two numbers ...Best Answer: Percentage difference between two numbers X and Y is: Y/X - 1 ... Percentage difference simply involves: - finding the difference between the ... What Is the Difference Between Rational Number and Whole Numbers ...Rational numbers are numbers that include the smaller groupings of natural numbers, whole numbers and integers. There are clear differences between each of the ... How To Find The Difference Between Any Two Numbers, The Greater Of ...Take as many 9's as there are figures in the less number, and subtract the one from the other. Let another person add that difference to the larger number; and then ... Difference Between Numbers and Numerals | Difference BetweenNumbers vs Numerals Number and numeral are two related, but two distinct concepts. Sometimes, people confuse the numeral with the number. What we write is Difference between two numbers - Microsoft Corporation: Software ...Hi , In c# I want to find the integer value of e.g. -5, how do I do this? For example 10-5 = 5 but 5-10 = -5, I just want to know what the difference is ... 7/27/2012 11:50:49 PM
|