Skip to Main Content

Oracle Database Express Edition (XE)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SIMPLE SQL QUERY WITHIN A TABLE (if statement)

734444Nov 16 2009 — edited Nov 17 2009
Hello everybody

i have a table and want to interprete it by means of performing comparisions between cells of different rows, say colum 4 and 6 and so for all of the rows

the comparision can be just a division but the problem is when i have a 0 as in here X/0

so i need to tell the query to check first if there is a 0 in order to ignore that and continue down the table to the next rows

i have been given this which worked in sql developer and also in the script but the wizzard when I was going to launch the report in XE came up with a error shown below


select company, postcode,
case
when count(staff) != 0 then sum( bosses/staff) end
from evaluation
group by company, postcode


1 error has occurred
query column #3 (CASEWHENCOUNT(STAFF)!=0THENSUM(ADDICTS/STAFF)END) is invalid, use column alias


I dont know where to put it, i have tried in many places and it never works, besides i dont know if the query should be formatted otherwise so as to avoid that error..


thank you very much

Alvaro
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 15 2009
Added on Nov 16 2009
5 comments
1,231 views