以下是我正在使用的代碼。如何將列的最大值存儲爲變量,然後將其用於MySQL中的計算?
Select max(heart_rate) as Max_heart, Count(*) from exercise_logs
where heart_rate between (0.5*Max_heart) and (0.9*Max_heart);
我是新與SQL,但我覺得這本來是很容易的東西,如R.不管怎麼說,因爲我需要在SQL中完成的,對我怎麼做到這一點有什麼建議?
我的數據是這樣的
type minutes calories heart_rate
biking 30 100 110
biking 10 30 105
dancing 15 200 120
dancing 15 165 120
tree climbing 30 70 90
tree climbing 25 72 80
rowing 30 70 90
hiking 60 80 85
什麼是所需的輸出應該是什麼? – Rahul
我懷疑你做得比它需要的更復雜。你能更徹底地描述你的問題嗎? – Strawberry