0
hibernateを使用して同様のクエリを実行します。 @runtot as 0
と設定すると、同時に実行されている別のクエリが間違った結果になる可能性があるため、私は懸念しています。予想される使用の下で休止状態での実行中の合計を使用したクエリ
SET @runtot:=0; select name, quantity, (@runtot := @runtot + quantity) as runtotal from item where @runtot+quantity <= 20;