Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 SELECT 语句,它返回给定间隔内 3 列的最大值,但我需要知道这个最大值发生在哪一列,有人可以帮忙吗?我目前的代码是:
$con->prepare("SELECT MAX(GREATEST(L1_RMS,L2_RMS,L3_RMS)) AS maior_valor FROM ELEVA WHERE <conditions>")
提前感谢您的任何想法。
SQL小提琴
select id, GREATEST(L1_RMS, L2_RMS, L3_RMS) value, case GREATEST(L1_RMS, L2_RMS, L3_RMS) when L1_RMS then 'L1_RMS' when L2_RMS then 'L2_RMS' when L3_RMS then 'L3_RMS' end columnName from table