View previous topic :: View next topic
|
Author |
Message |
NeeluJoshi
New User
Joined: 12 Dec 2007 Posts: 8 Location: Florida
|
|
|
|
Hi,
I have two tables
Student(Studentid,studentname)
Course(studentid, courseid)
For one student id there can be many courseids
I want to join these two tables and display the results like
Studentid1 courseid1 courseid2 courseid3
Studentid2 courseid3 courseid4
Can anyone help me on this. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
Impossible with a single query. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
The biggest limitation is that the number of courses per student varies and you need to select all the return fields in the ... of the the SELECT ... FROM statement. |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
I dont think it 's possible |
|
Back to top |
|
|
rag swain
New User
Joined: 17 Dec 2007 Posts: 33 Location: pune,INDIA
|
|
|
|
Can you show some data from both the tables? Are there other columns related to course_id in COURSE table |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
You need to do this in a post processing program.
The O/P gave the format of the original data. You can come up with your own dataset based on what they gave.
Here, I'll give you one.
Code: |
--student table
Studentid studentname
---------- -----------
11111 Bob Jones
12345 John Doe
--Course table
studentid courseid
--------- --------
11111 123
11111 124
11111 125
11111 127
11111 128
11111 129
11111 130
11111 200
12345 123
12345 124
|
|
|
Back to top |
|
|
rag swain
New User
Joined: 17 Dec 2007 Posts: 33 Location: pune,INDIA
|
|
|
|
Why not thru a program? Is this a real time scenario/request ,OR, just out of curiosity ,OR, are you trying to generate a formatted report as part of adhoc request thru QMF? Crazy one without program! |
|
Back to top |
|
|
|