問題タブ [postgresql-14]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
sql - 以前の記録に基づいて、合計フィールドを停止します
次のようなテーブルがあります。
私の目標は、ポイントが1以上である日付から現在までのsを取得sum
し、point
その日付より前のフィールドの合計を停止することです。
上記の例 (日付順) では、答えはsum
date now( 2022/01/06
) から date2022/01/04
および equals です9 + 7 + 1 = 17
。日付のポイント値は2022/01/03
4 であるため、 では計算されませんsum
。
CTEとWindow Functoinについて読みましたが、適切に実装できませんでした。