-1
值我从那里我得从indicator_id多个列中的最低和最高值,在MySQL数据库中的表,找到最低和最高的多列
像
Indicator_id threshold_id colour Strat_value End_value
2004 1 Green 2 2
2004 2 Amber 1 1
2004 3 Red 0 0
2004 4 Black -1 -10
表数据数据我用下面的代码,但没有得到正确的结果
select indicator_id,
least(Start_value,End_value) low,
greatest(Start_value,End_value) high
from shrewd_db.threshold
group by id_indicator;
任何帮助,将不胜感激。 感谢
向我们展示样本数据和预期的输出。 \t请阅读[**如何提问**](http://stackoverflow.com/help/how-to-ask) \t \t这里是一个伟大的地方[** START **] (http://spaghettidba.com/2015/04/24/how-to-post-at-sql-question-on-a-public-forum/)来了解如何提高您的问题质量并获得更好的答案。 –
我要走出去像indeicator_id = 2004,低= 2和高= 2 – Sumon
是的,但什么应该是正确的输出? –