I want the 2 compute column to show only 4 decimal, but I cant find a way to affect the return value of 'em.
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(p rice 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
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(p rice 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
Code:
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)))
Comment