I have the following table:
TABLE A:
StudentNumber Subject1 Subject2 11111 AAA BBB 22222 AAA BBB
how will i display the multiple values in row into one column?
RESULT TABLE:
StudentNumber Subject 11111 AAA 11111 BBB 22222 AAA 33333 BBBB
This requires a UNION query. There is no wizard for UNION. Must type (or copy/paste) in the SQL View of query designer. This will essentially rearrange the data into the structure it should have been in.
SELECT StudentNumber, Subject1 AS Subjects FROM Registration
UNION SELECT StudentNumber, Subject2 AS Subjects FROM Registration;
Then join the UNION query to the SubjectSched table.
Last edited by June7; 05-09-2013 at 10:10 PM.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
thanks for the help... appreciate so much... i tried the UNION but i used INNER JOIN... thanks again...
Ooops! I forgot to use UNION in my query example. Take another look at the corrected post.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thank you... June7... it helps me a lot... I figure out other query codes by using INNER JOIN....
here is my code,, it works already... thank you...
SELECT StudentNumber, LastName & ", " & FirstName & " " & MI AS NAME, Section, SectionSubjectCode, Unit, Days, Time, Room
FROM SubjectSched INNER JOIN Registration ON Registration.Subject1=SubjectSched.SectionSubjectC ode Or Registration.Subject2=SubjectSched.SectionSubjectC ode Or Registration.Subject3=SubjectSched.SectionSubjectC ode Or Registration.Subject4=SubjectSched.SectionSubjectC ode Or Registration.Subject5=SubjectSched.SectionSubjectC ode Or Registration.Subject6=SubjectSched.SectionSubjectC ode Or Registration.Subject7=SubjectSched.SectionSubjectC ode Or Registration.Subject8=SubjectSched.SectionSubjectC ode Or Registration.Subject9=SubjectSched.SectionSubjectC ode;
thank you po...
I have never seen a join clause like that. I never would have considered it and don't understand how it can work but if you are getting what you want then congratulations.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.