We help IT Professionals succeed at work.
Get Started

Need more help with a SQL query

saabStory
saabStory asked
on
267 Views
Last Modified: 2012-05-12
I'm not sure if what I'm trying to do is even possilbe.  I have two tables - one for top level course categories and the other with course levels and course names.  I'm trying to figure out if I can generate a list from SQL that first lists the top level category, then the program levels within that category and then the course names within each program level.

The schema for the two tables is below and I could break things up into 3 tables if need be.  I am trying to get the output to do something like:

Category 1
  Program Level 1
    Course 1-1-1
    Course 1-1-2
    Course 101-3
  Program Level 2
    Course 1-2-1
    Course 1-2-2

Category 2
  Program Level 1
    Course 2-1-1
  Program Level 2
    Course 2-2-1
    Course 2-2-2

And so forth..  The number of program levels and courses varies.  Some Categories have 5 or 6 Program Levels while others only have 1.  Ditto for the Courses - some Program Levels might have 12 Courses while others only have 1 or 2.

As always, thanks in advance for any help on this.
tbl_Categories
====================================
catID	  int (pk)
catName	  nvarchar(50)
catOrder  int


tbl_ProgramLevels
====================================
pID	      int
catID	      int
progLevel     nvarchar(50)
progCourse    nvarchar(50)

Open in new window

Comment
Watch Question
Senior DBA
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE