我有一个具有以下模式的表
id data rank usage
1 hi 19 H
2 he 14 M
3 me 9 L
4 ke 23 H
5 jo 11 M
6 km 2 L
7 lo 4 L
8 no 12 M
9 my 20 H我想做一些像这样的事情
If max(rank) where usage='L'>=25 Then Select all records where usage='H' Else If max(rank) where usage='M'>=25 Select all records where usage='L' and records where usage='M' ELSE Select all records
SQL不支持以下语句:
SELECT CASE WHEN (select max(rank) from my_table where usage='L') >= 100
那么,我应该如何编写这个查询呢?
https://stackoverflow.com/questions/44537909
复制相似问题