The objective of this task is to display the instructor in


SQL Question

The objective of this task is to display the instructor ('IN') names in one column for each section separated by a semicolon. (all the outputs(columns) are from same tables )

SELECT

   section_id,

   temp_person_name

FROM

   stan.section_person

WHERE

   rnr_role_code = 'IN';

The code will have this output.

SECTION_ID TEMP_PERSON_NAME                                                         

---------- --------------------------------------------------------------------------------------------------------------------------------

    93 Herscher, Joshua                                                         

    93 Vankanegan, Steve                                                        

    95 Peyser, Michael                                                         

    96 Hoggard, Zabrina                                                         

    96 Simmons, Ghia                                                          

    60 Esirgen, Gokhan                                                         

    60 Griffith, Ryan

-- Expected/Desired Result

/*

60 Esirgen, Gokhan; Esirgen, Gokhan

93   Herscher, Joshua; Herscher, Joshua

95   Peyser, Michael

96   Hoggard, Zabrina; Simmons, Ghia

*/

My code is this:

SELECT section_id,

    temp_person_name = STUFF( // this is line 10

    (SELECT ',' + temp_person_name

        FROM stan.section_person 

        WHERE rnr_role_code = 'IN'

        FOR XML PATH('')), 1, 1, ''

        )

    FROM stan.section_person

    GROUP BY section_id;

and the output error is this:

ORA-00923: FROM keyword not found where expected

00923. 00000 - "FROM keyword not found where expected"

*Cause:   

*Action:

Error at Line: 10 Column: 25

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: The objective of this task is to display the instructor in
Reference No:- TGS02631090

Now Priced at $20 (50% Discount)

Recommended (98%)

Rated (4.3/5)