日期:2014-05-17  浏览次数:20652 次

復雜查詢語句
jonum finishflag
PJ00002832 1
PJ00002833 0
PJ00003588 0
PJ00003588 1
PJ00003620 0
PJ00003620 1
PJ00003629 0

以上jonum如果有兩筆finishflag存在真和假,那么返回0,只有一筆那么取finishflag對應的值。如下結果


jonum finishflag
PJ00002832 1
PJ00002833 0
PJ00003588 0
PJ00003620 0
PJ00003629 0

------解决方案--------------------
select jonum,min(finishflag)finishflag from tb group by jonum