我的桌子
+----+----------+---------+---------+----------+
| ID | State A | State B | State C | Duration |
+----+----------+---------+---------+----------+
| 1 | a | a | a | 12 |
+----+----------+---------+---------+----------+
| 2 | a | a | a | 15 |
+----+----------+---------+---------+----------+
| 3 | a | a | b | 12 |
+----+----------+---------+---------+----------+
| 4 | a | b | b | 30 |
+----+----------+---------+---------+----------+
| 5 | b | b | b | 12 |
+----+----------+---------+---------+----------+
如果3列具有相同的值和持续时间< 15 结果如下:
+----+-----------------+
| ID | THE RESULT |
+----+-----------------+
| 1 | a is the winner |
+----+-----------------+
答案 0 :(得分:0)
这是一个过滤器以及concat()
:
select concat(statea, ' is the winner')
from t
where statea = stateb and stateb = statec and duration < 15