Home » SQL & PL/SQL » SQL & PL/SQL » Need help in SQL statement (Oracle 10.2.0.3.0 Solaris)
Need help in SQL statement [message #384940] Thu, 05 February 2009 16:49 Go to next message
ldhullipalla
Messages: 4
Registered: January 2009
Location: Reston
Junior Member
Hi,
My present query
select YEAR,CTO,TEAM,count(*) from tbl1 a,tbl2 b where a.year=b.year and a.bsl_nmbr=b.bsl_nmbr
group by YEAR,CTO,TEAM is giving output like

Year CTO TEAM ACTION_COUNT
2009 laxman HR 15
2009 prabha Sales 12
2009 Ram Mrktng 08
2008 laxman HR 03
2008 Alex Fin 11
.
.
.

2007 laxman HR 07

My out put should be

Year CTO TEAM 2009_count 2008_count 2007_count

2009 laxman HR 15 03 07
2009 prabha Sales 12 null null
2009 Ram Mrktng 08 null null
2008 Alex Fin 11 null null

Thanks in Advance
Lakshman
Re: Need help in SQL statement [message #384947 is a reply to message #384940] Thu, 05 February 2009 20:02 Go to previous message
BlackSwan
Messages: 25041
Registered: January 2009
Location: SoCal
Senior Member
search for PIVOT in this forum
Previous Topic: how to get hands on SQL PL/SQL
Next Topic: Update Script - Increment Value
Goto Forum:
  


Current Time: Tue Dec 06 08:49:42 CST 2016

Total time taken to generate the page: 0.17113 seconds