select orderId, count(case paid when 'N' then 1 end) from orderitem

 

use case to filter data

 

refer: https://stackoverflow.com/questions/1400078/is-it-possible-to-specify-condition-in-count

    全站熱搜

    咪卡恰比 發表在 痞客邦 留言(0) 人氣()