Results 1 to 6 of 6

Thread: With clause

  1. #1
    Join Date
    May 2008
    Posts
    39

    Unanswered: With clause

    Hi

    Myreq is:I have emp rable with data as :
    100 a
    100 b
    100 u

    it should be displayed as

    100 a b c

    My qry is :
    WITH PARENT (NO, NAME,NAME1,level) as
    (SELECT NO, NAME ,NAME,1
    FROM IDM_DEV.zz_empt2
    WHERE NO =100
    UNION ALL
    SELECT P.no, C.name,P.name,P.level+1
    FROM IDM_DEV.zz_empt2 C
    ,PARENT P
    WHERE P.NO =C.NO
    )
    SELECT no,name,name1
    FROM PARENT where level=2;

    I am not getting dsired result..Please suggest any other way to do it
    thnaks

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    there have been many similar requests before
    search on pivot data or goto developer works and check for pivot table db2
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Jul 2006
    Location
    Pune , India
    Posts
    433
    if v9 you can also use xml functions to acheive same
    Rahul Singh
    Certified DB2 9 DBA / Application Developer

  4. #4
    Join Date
    May 2008
    Posts
    39
    Can you please give some example,if possible

  5. #5
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483

  6. #6
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Why don't you try to search for it, first?
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •