I wrote down this command "compute avg(x)" because I need the average to be in a seperate table.
When you use compute avg(x) here x is cast (price as decimal(10,4)) because I need the price to show up in the main table, and I need it with 4 decimals.
So I need a way to cast the return value of compute avg(x) but I dunno how to write it down.
I've tried these form and both doesnt work
cast (compute avg(cast (price blabla)) blabla)
compute cast(avg(cast(price blabla))blabla)
I am not sure what you want me to group by or rollup and how it'll help me here, can you develop ?
Heres my code
Expand|Select|Wrap|Line Numbers
- select title_id, cast (price as decimal(10,4)), cast(advance as decimal (10,4)) as'advance'
- from titles
- order by title_id asc
- compute avg (cast (price as decimal(10,4)))
- compute sum (cast(advance as decimal (10,4)))