如果批量中存在某种类型的记录,我试图从查询中跳过一组记录。
我有这样的记录
ORDER STATUS
1234 X
1234 Y
1234 Z
1235 X
1235 Y
1236 X
1237 X
1237 Y
1238 A
1238 B
如您所见,订单经历了多个阶段(X,Y,Z,A,B)。我想选择没有达到某种状态的订单,即Z或B.所以从上表中我只应该选择订单号和状态,其中该订单的状态没有转到Z或B.
感谢任何帮助。 感谢。
答案 0 :(得分:3)
使用select t.*
from t
where not exists (select 1 from t t2 where t2.order = t.order and t2.status in ('Z', 'B'));
:
select order
from t
group by order
having sum(case when status in ('Z', 'B') then 1 else 0 end) = 0;
如果您只想要没有这些状态的订单,可以使用聚合:
i = inp
i = Conv2D(filters = 64, kernel_size = 4)(i)
i = BatchNormalization()(i)
i = LeakyReLU()(i)
i = MaxPooling2D(2)(i)
i = Conv2D(filters = 64, kernel_size = 4)(i)
i = BatchNormalization()(i)
i = LeakyReLU()(i)
i = MaxPooling2D(2)(i)
i = Conv2D(filters = 64, kernel_size = 4)(i)
i = BatchNormalization()(i)
i = LeakyReLU()(i)
i = MaxPooling2D(2)(i)
i = Conv2D(filters = 64, kernel_size = 4)(i)
i = BatchNormalization()(i)
i = LeakyReLU()(i)
i = GlobalMaxPooling2D()(i)
i = Dense(len(labels), activation = 'softmax')(i)
答案 1 :(得分:0)
试试这个
SELECT * FROM table_name WHERE STATUS NOT LIKE('B') AND STATUS NOT LIKE('Z');
这将返回所有未达到状态 B 或 Z 的记录。