在其他两列均为零的列中查找最小值 [英] Finding the min in a column where two other columns are zero
本文介绍了在其他两列均为零的列中查找最小值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试编写一个MySQL搜索,该查询将找到最低的imageID
,其中其他两列=0.在这种情况下,返回的imageID
将为8.
I am trying to write a MySQL search that will find the lowest imageID
where the other two columns = 0. In this case the imageID
returned would be 8.
ImageId Processing Finished
5 0 1
6 1 0
7 0 1
8 0 0
9 1 0
10 0 1
11 1 0
12 0 0
13 0 0
14 0 0
15 0 0
推荐答案
select min(ImageId) from tablename where processing=0 and finished=0;
这是相当基本的SQL,如果您自己进行一些研究,很容易找到它.
This is fairly basic SQL, and can easily be found if you do some research of your own.
这篇关于在其他两列均为零的列中查找最小值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文