Home » SQL & PL/SQL » SQL & PL/SQL » sql hard
sql hard [message #219304] Tue, 13 February 2007 22:43 Go to next message
reyazan
Messages: 53
Registered: February 2005
Member
I have data in oracle 8i table like below

select dept_no,stn,sum(sal),sum(decode(dept_no,22,hra)) hra from
TEST11 group by dept_no,stn;

DEPT_NO STN SUM(SAL) HRA
-------- ---------- ---------- ----------
11 111 2000
22 221 3000 100
22 222 3000 100
33 333 4000
44 444 5000

Now i want to add an expression in above sql in which all rows of SUM(SAL)
divided by 100 (through expression not contant).

please help

Re: sql hard [message #219361 is a reply to message #219304] Wed, 14 February 2007 02:45 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Well, I don't understand what you mean when you say 'divided by 100 (through expression not constant)', so I'll let you explain by telling me what is wrong with this:
SELECT dept_no 
      ,stn
      ,sum(sal)/100
      ,sum(decode(dept_no,22,hra)) hra 
from   TEST11 
group by dept_no,stn;
Previous Topic: create temporary tablespace ...; V.S create tablespace ... temporary;
Next Topic: Need Help in Grouping
Goto Forum:
  


Current Time: Sat Dec 10 16:19:08 CST 2016

Total time taken to generate the page: 0.07429 seconds