Multiply value by literal/constant #3970
Unanswered
marcoschulte
asked this question in
Q&A
Replies: 1 comment 4 replies
-
That's just transactions::table
.select(
sum(transactions::value) * BigDecimal::from_i8(-1).unwrap()
)
.load::<(Option<BigDecimal>)>(conn) You can use the usual rust operators (+, -, *, /) there to construct the corresponding query. That works as long as the rust side value is compatible to the SQL side type. In that case I assume that your |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
unfortunately I cannot figure out how I would multiply a value by a constant, in my case
-1
.To make it more clear, here is some very basic example:
Is there a way to write that? I tried something along the lines of
-1.into_sql::<Numeric>()
, but whatever I tried I had no success.Would be glad for any help!
Beta Was this translation helpful? Give feedback.
All reactions