[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

needs help in query

Summary report that list aggregate counts of students that graduated from abc public colleges and universities. In 2010, by the level at which the degrees were awarded are associate, baccalaurate, master, doctoral. Within each field of study that is accounting, nursing, phy, engineering, etc. Query should list only the top 25 fields of study and the number of degrees awarded for each degree level. The top 25 is determine by the total degree awarded for each field of study

Gfice int college id number
gstid int student id number
gdob student date of birth
Ggradyr int year the student graduated
gdegcip int national field of study code
gdeglvl int degree level
cpicode int national field of study code
cipdesc char national field of study description
0
mustish1
Asked:
mustish1
  • 2
  • 2
  • 2
2 Solutions
 
mustish1Author Commented:
Degree lvel codes
03 Associate Degree
05 Bachelors Degree
07 Masters degree
09 doctors degree
0
 
BusyMamaCommented:
Two queries -

One showing the Top 25 for 2010
Second showing the details for the identified 25

Query 1:
SELECT TOP 25 Count(gstid), Ggradyr, gdegcip
FROM TableName
GROUP BY Ggradyr, gdegcip
HAVING Ggradyr = "2010":

Query 2:
SELECT Query1.gdecip, gdeglvl, count(gstid)
FROM Query1, TableName
GROUP BY Query1.gdecip, gdeglvl
HAVING Query1.Ggradyr = "2010";
0
 
deightonCommented:
if you can write your aggregate query, ignoring the top 25 part of it, you can the make that a sub query and query


e.g.

SELECT TOP 25 * FROM (..your aggregate query in here.including CountOfDegrees..) AS SubQ ORDER BY CountOfDegrees

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
deightonCommented:
oops, I see you are in ACCESS though, I am thinking along the lines of SQL server
0
 
mustish1Author Commented:
Np I just need query either in access or sql server
0
 
BusyMamaCommented:
deighton, I believe you can do it that way, even in Access, if you go to the SQL view of the query.  I didn't even consider that.  Good thought!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now