473,395 Members | 1,471 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,395 software developers and data experts.

Help with query - problem getting the right records

Hi y'all,

I've been struggling with this query for over 2 weeks and have tried so many ways to do it I've lost count.

I have a student DB. Current student's records can be queried by the SchoolYear field with a function fGetFiscalValues which will return only students in the current year. This is good because I don't want to include any students in my query who are not current students.

However, I want to get current students, and then compare their Math and Reading Grade against their Math and Reading grade for previous years. Since the method I'm using to get current students doesn't include previous years, I can't figure out a way to do this.

I think I need an outer join, but when I do it that way, the query records don't show the StudentID for the outer joined records, so then I don't know what to do with them.

I have the same problem with comparing the grades to a current assessment. I only want to look at the assessment they took the current year, but I want to compare the results to their grades for this year and any previous years they also attended.

Can anyone give me some advice? I've run out of ideas again.

Thanks,
~BeeMarie
Jul 9 '07 #1
5 1324
NeoPa
32,556 Expert Mod 16PB
I think we can probably help here, but we would need MetaData for the table(s) used and the code for the function too.
Here is an example of how to post table MetaData - please use this same format :
Table Name=tblStudent
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo
  2. StudentID; AutoNumber; PK
  3. Family; String; FK
  4. Name; String
  5. University; String; FK
  6. Mark; Numeric
  7. LastAttendance; Date/Time
Jul 9 '07 #2
Table=tblStudents
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo; Comment
  2. StudentID; Long Int; PK; Student’s ID
  3. StudentLastName; String
  4. StudentFirstName; String
tblStudentEnrollment
StudentEnrollmentID > PK A# long int
StudentID > fk to tblStudents, long int
fkGradeLevelID > fk to tluGradeLevel (long int, fk string)
fkSchoolsID > fk to tluSchools (long int, fk string)
SchoolYear > qtluSchoolYears (string like 04-05, 06-07, etc.)

tblStudentClassGrades
StudentClassGradesID > PK A#
fkStudentEnrollmentID > fk to tblStudentEnrollment, long int
fkSubjectID > fk to tluSubjects (long int, fk string)
fkClassGradeID > fk to tluClassGrades, (long int, fk string)

The function is fGetFiscalValues()
It returns the current school year as a string like 06-07 which allows me to query students who are current.

I really don't want to add another field like "exit" or "status" unless I absolutely have to, because I am concerned that these fields wouldn't be kept up to date. The purpose of this db is only to analyze grades and scores, it is not intended to track anything that isn't needed for that purpose. I was just thinking that maybe I could make the query put a date based on the SchoolYear string. Then I could query on a date range of 3 years. I'm not sure how I'd do that though.

I appreciate any advice. I am sorry if I put more info than is needed to help.

~BeeMarie
Jul 9 '07 #3
NeoPa
32,556 Expert Mod 16PB
BeeMarie,

I don't have any trouble with extra data, but as this is in quite a different format from what I was expecting (as laid out in my earlier post) it may take me some time deciphering what is meant by what.
I need to pack it in for the night now anyway, but I'll try to get back to this in the coming days (Normally I'd say tomorrow but I know my schedule is hectic until Thursday so I don't want to make any promises I can't keep).
Jul 9 '07 #4
tlu = table lookup...not that important to this query really.

I figured out that putting a date range in place of the school year still doesn't tell me if a student is current. I don't want to waste anyone's time...I am thinking the only way this is going to work is to add some kind of Status field to the Students table.

Thanks,
~BeeMarie
Jul 9 '07 #5
NeoPa
32,556 Expert Mod 16PB
Using your data structure, how would YOU determine if a student were current or not?
I would guess it's something to do with enrollment and the current year?
Jul 10 '07 #6

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

Similar topics

15
by: Philip Mette | last post by:
I am begginner at best so I hope someone that is better can help. I have a stored procedure that updates a view that I wrote using 2 cursors.(Kind of a Inner Loop) I wrote it this way Because I...
20
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File...
1
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
8
by: Steph | last post by:
Hi. I'm very new to MS Access and have been presented with an Access database of contacts by my employer. I am trying to redesign the main form of the database so that a button entitled...
14
by: Darin | last post by:
I have a table that I want to delete specific records from based on data in other tables. I'm more familiar with Access '97, but am now using 2003, but the database is in 2000 format. In '97, I...
1
by: VMI | last post by:
I need to display Access data in a datagrid but the Access table has over 2 million records. Since I can't fill a datatable with all those records but the user needs to see all of them, how can I...
47
by: Jo | last post by:
Hi there, I'm Jo and it's the first time I've posted here. I'm in process of creating a database at work and have come a little unstuck.....I'm a bit of a novice and wondered if anyone could...
2
by: melchior | last post by:
Hi, I have searched and searched without much luck. I feel like I am doing the right thing, just not getting the right result, so here goes. I have 2 tables. One has about 100,000 records...
1
by: RussCRM | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
11
by: troy_lee | last post by:
I have two fields on a form. These two fields' values are based on an expression and represent a date range. I need to create a SQL statement that will use the returned values of these two fields...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.