Loading ...
Sorry, an error occurred while loading the content.

10650RE: [PkOug] Need Query

Expand Messages
  • shayan ahmed
    Nov 6, 2013

      For Database 11g, you can use listagg function. Hope it works.

      select student_reg_no  ,listagg(course_id ,',')  WITHIN GROUP (ORDER BY course_id) from course
      group by student_reg_no 


      Shayan Ahmed
      Oracle APEX Developer

      From: tahir.majid@...
      To: PkOug@yahoogroups.com
      Date: Tue, 5 Nov 2013 12:05:30 +0500
      Subject: [PkOug] Need Query


      Dear Members,
      I have following tables

      table student:

      student_name       student_reg_no
      ali                                  1
      tahir                                2

      table course

      student_reg_no            course id
                1                             1
                 1                            2
                 1                            3
      I need a query to represent the course in single coulumns
      student_reg_no                 course id
      1                                         1,2,3

      how can i write this query, kindly help

    • Show all 9 messages in this topic