私は次のコード実行されたMySQLデータベースのテーブル(shrewd_db.threshold)を有するは値のMySQLの別の範囲と値の範囲を比較
select id_indicator, id_threshold, activation_begin_value, activation_end_value
from shrewd_db.threshold
where active =1
group by id_indicator, id_threshold;
次のように私の出力は、次のとおり
id_indicator id_threshold activation_begin_value activation_end_value
2 5 4 58
2 6 3 3
2 7 1 2
2 8 0 0
4 13 0 4.5
4 15 4.1 5.5
4 16 5.51 6
4 17 6.01 100
各id_indicatorには4つのid_thresholdの範囲があります。
データ検証チェックのために、各インジケータid_threshold(activation_begin_valueおよびactivation_end_value)が別のしきい値に収まらないことを確認する必要があります。
id_indicator(4)は、2つのid_threshold(13,15)の値が互いに低下id_indicator id_threshold activation_begin_value activation_end_value
4 13 0 4.5
4 15 4.1 5.5
:
私の所望の出力は次のようであるべきです。あなたは出力を取得しているために - - 主にしきい値が
'id_indicator(4)2つのid_threshold(13,15)の値がお互いに落ちる' =>これは意味をなさない。あなたはなぜこれらの2行だけを出力に必要とし、他の行を必要としないのかを精緻化できますか? – Utsav
例IDインジケータ4の値は4.2ですが、値が4.2であることを確認する必要がある場合は、しきい値を下回って、結果がしきい値13および15に上がります。一般に、各しきい値には固有の値域が必要ですデータの妥当性チェック私はすべてのこれらの異常を見つけて、しきい値の問題を解決する必要があります – Sumon