Oracle
 sql >> Database >  >> RDS >> Oracle

aggiungi $ e arrotonda 2 decimali SQL

Potresti provare questo:

'$' || Cast((select avg(retail) from cars 
where brand = 'FORD' or brand = 'TOYOTA') as decimal(4,2)) as AVG_BRAND_PRICE_01

Se vuoi più di $XX.XX, ad es. $XXXXXXX.XX, dovrai impostare il decimale più alto, ad es. decimale(9,2)

Esempio di SQL Fiddle:http://www.sqlfiddle.com/#!4 /9f684/2/0