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

10655Re: [PkOug] Need Query

Expand Messages
  • Hanif Babar
    Nov 9, 2013
      Dear Tahir,

      Modify below sample query according to your table.

      QUERY
      ============
      select       t.deptno,
                      wm_concat(e.empno)
      from         dept t,
                      emp e
      where       t.deptno = e.deptno
      group by  t.deptno
       
      OUT PUT
      =======================

      1    10    7782,7839,7934
      2    20    7369,7902,7876,7788,7566
      3    30    7499,7698,7654,7844,7900,7521


      Regards
      Muhammad Hanif Babar


      On Friday, November 8, 2013 1:26 PM, Muhammad Farooq <muhammad.farooq_ch@...> wrote:
       
      Dear Majid Tahir

      check this one..

      select student_reg_no,rtrim(xmlagg(xmlelement(e, course_id || ',')).extract('//text()').extract('//text()') ,',') course_id from course
      group by student_reg_no;
       
      Regards,
       
      MUHAMMAD FAROOQ
      Deputy Manager Systems
      Samin Textile ltd. Lahore
      Cell: +92-306-7037237
       


      On Wednesday, November 6, 2013 4:26 PM, Majid Tahir <tahir.majid@...> wrote:
       
      AOA,
      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
      like
      student_reg_no                 course id
      1                                         1,2,3

      how can i write this query, kindly help




    • Show all 9 messages in this topic