For example, I have the arithmetic column on the “calculation” table and I need to multiply that result with the column named Valeu
id | value | arithmetic |
---|---|---|
1 | 30 | ‘0.975/24’ |
2 | 35 | ‘0.834/24’ |
Something like:
-
id 1: ‘0.975/24’ * 30, result = 1.21875
-
id 2: ‘0.834/24’ * 35, result = 1.21625
I tryed some variations of the query but I keep getting NULL:
with calculation (id, value, arithmetic) AS
(VALUES
(1,30,'0.975/24'),
(2,35,'0.834/24')
)
SELECT id, (value * arithmetic) as calc from calculation
databricks-sql result
The pattern used on the arithmetic column can be altered, any suggestions?
New contributor
Elder Carvalho is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1