Live ORACLE

if you are Oracle Developer ,than this Blog most likely will make you happy.

About my Blog

This Blog particularized for Oracle Developers ... you will see interesting Codes for SQL , PL/SQL as well as new ideas for Developer Suite and Client Tools that will help you in your professional life ... and I hope I reach for your satisfaction.

About Me

I'm Hany Freedom , 25 years old , I live in EL-Minia City in Egypt , I'm Moderator at ArabOUG.org the best Arabic Forum for ORACLE on the Net. if you interested to know more about me .... just Click Here.

CROSS MATRIX report


rem -----------------------------------------------------------------------

rem UPDATED version

rem Filename: matrix.SQL

rem Purpose: Example of a CROSS MATRIX report implemented USING

rem standard SQL.

rem Date: 12-Feb-2000

rem Author: Frank Naude, Oracle faq

rem

rem Updated By Mahesh Pednekar. (bunty609@hotmail.com)

rem Description Removed the Main query because the sub query itself

rem will full fill the requirement.

rem -----------------------------------------------------------------------


SELECT job,

Sum(Decode(deptno,10,sal)) dept10,

Sum(Decode(deptno,20,sal)) dept20,

Sum(Decode(deptno,30,sal)) dept30,

Sum(Decode(deptno,40,sal)) dept40

FROM scott.emp

GROUP BY job

/

-- Sample output:

--

-- JOB DEPT10 DEPT20 DEPT30 DEPT40

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

-- ANALYST 6000

-- CLERK 1300 1900 950

-- MANAGER 2450 2975 2850

-- PRESIDENT 5000

-- SALESMAN 5600

--


Share/Save/Bookmark

0 comments:

Post a Comment



Newer Posts Older Posts Home Page
 
http://www.dpriver.com/images/sqlpp-banner-2.png

Thanks for reading my Blog ... you Visitor Number :-