I have two columns called quantity and price. Quantity is divided by price. If the result contains decimal, I want the number before the decimal. Or else, the number as it is.
Asked
Active
Viewed 1,148 times
3 Answers
1
I think you are looking for:
select floor(quantity / price) as output

Gordon Linoff
- 1,242,037
- 58
- 646
- 786
0
Casting issues?
select cast(quantity / price as bigint)
By the way, I think you may want this: Hive Data Types Manual

staticor
- 620
- 9
- 19