DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: how to write SQl query for the given problem below with a self join

Threaded View

  1. #2
    Join Date
    Sep 2005
    Posts
    278
    Hope this will help you.

    Code:
    SELECT distinct grade,
            count(decode(job_type, 'Type1', 1))
                    over(partition by grade) t1,
            count(decode(job_type, 'Type2', 1))
                    over(partition by grade) t2,
            count(decode(job_type, 'Type3', 1))
                    over(partition by grade) t3
    FROM emp_grade
    ORDER BY 1
    Last edited by tabreaz; 07-26-2007 at 05:51 AM.

Posting Permissions

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


Click Here to Expand Forum to Full Width