我有一個查詢返回令牌具有特定分類的概率。使用SQLite將組中的行相乘
token class probPaired
---------- ---------- ----------
potato A 0.5
potato B 0.5
potato C 1.0
potato D 0.5
time A 0.5
time B 1.0
time C 0.5
我需要將每個class
的概率乘以它們的總和。
-- Imaginary MUL operator
select class, MUL(probPaired) from myTable group by class;
class probability
---------- ----------
A 0.25
B 0.5
C 0.5
D 0.5
如何在SQLite中執行此操作? SQLite沒有像LOG
/EXP
或變量的功能 - 解決方案mentioned in other questions。
@GurV這些問題的答案並不適用於SQLite的,[它缺乏LOG或EXP(https://sqlite.org/lang_corefunc.html)實施變通。 – Schwern