|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Is there a way to use a SQL statement in an ASP page to group results by one field (using group by and do while/loop). For example, say I was trying to group courses by students. I would like to display the information like this:
John Smith Biology Fall 2002 Sociology Spring 2003 Chemistry Fall 2002 Jack Jones Biology Spring 2003 Psychology Fall 2002 When I write the code, I get: John Smith Biology Fall 2002 John Smith Sociology Spring 2003 John Smith Chemistry Fall 2002 Jack Jones Biology Spring 2003 Jack Jones Psychology Fall 2002 |
|
#2
|
|||
|
|||
|
can you post the setup of your database so that i can work out a tsql query for you please?
|
|
#3
|
|||
|
|||
|
Thanks. I'm using Access
tbl_Courses CourseID - Number (Primary Key) CourseName - Text Session - Text tbl_Students StudentID - Number (Primary Key) StudentLastName - Text StudentFirstName - Text tbl_StudentCourses StudentID - Number (Primary Key) CoursesID - Number (Primary Key) (I know I should probably put the session in a separate table, but this is just a sample. I'm just trying to figure out how to get the student name once, followed by a listing of the course names ). If I could see how the SQL statement would work in this instance, I can hopefully apply it to more complex and (properly constructed) relational database. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Grouping Results in ASP using SQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|