0
我有身體脂肪預測和後測的數據。如果測試後的測試值大於預先測試的測試值,它只能增大2%,或者我不希望測試結果。後期測試值可以低於預測試的任何數量。查詢獲取彼此的2%以內的前值和後值?
此查詢僅適用於兩個值都在彼此的2%以內。缺失的部分是測試後測試低於預測試。任何幫助,將不勝感激!
SELECT LPAD(`studid` , 7, '0') AS studid,
bodpoints,
STR_TO_DATE(TestDate, '%m/%d/%Y') AS testd
FROM bodpod, points
WHERE ABS((post - pre)/pre) <= '0.02'
AND ID2 = 'fall'
AND studid != ''
GROUP BY studid
HAVING COUNT(DISTINCT ID1) >=1 AND YEAR(testd) = '2013'
謝謝!!!!!! – user2609500
沒問題,很高興幫助! – danielpsc