Home » SQL & PL/SQL » SQL & PL/SQL » sql matrix report
sql matrix report [message #214533] Tue, 16 January 2007 22:13 Go to next message
rzkhan
Messages: 345
Registered: March 2005
Senior Member
Hi all.. I have the following query wtih output.

  1   select substr(reg_no,1,4) as class,
  2   round((sum(gradenumericvalue))/(count(substr(reg_no,1,4))),2) as avrg,src.tempcolfac
  3   from src,grades_rt
  4   where src.gradecharvalue=grades_rt.gradecharvalue
  5   and semester_code=3 and semester_year=2005
  6   group by substr(reg_no,1,4),src.tempcolfac
  7*  order by 1 desc
EX > /

CLAS       AVRG TEMPCO
---- ---------- ------
2005       2.34 CS
2005       2.18 CSW
2005       2.94 EE
2005       2.47 ES
2005       2.64 ME
2005       2.15 MM
2004       2.74 CS
2004        2.7 CSW
2004       3.15 EE
2004       2.42 ES
2004       2.78 ME
2004       2.78 MM
2003       2.79 CS
2003       2.98 CSW
2003       3.27 EE
2003       2.95 ES
2003       2.57 ME
2003       2.82 MM
2002       2.62 CS
2002       3.26 EE
2002       3.15 ES
2002       2.72 ME
2002       2.79 MM
2001       2.84 CS
2001       1.93 EE
2001       1.62 ES
2001       2.22 ME
2001       1.38 MM
2000       1.54 CS
2000       1.17 EE
2000          0 ES
2000        .75 ME

32 rows selected.


How can I get this query like matrix report. as

CLASS     CS         EE
---- ---------- ----------
2000
2001
2002
2003
2004



Please help me...
thanks
rzkhan
Re: sql matrix report [message #214534 is a reply to message #214533] Tue, 16 January 2007 22:26 Go to previous message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
Search the site for "pivot".
Previous Topic: Clusters
Next Topic: date format related query
Goto Forum:
  


Current Time: Fri Dec 02 14:21:43 CST 2016

Total time taken to generate the page: 0.13357 seconds