テーブル名の領収書があります。スキーマは次のとおりです
account_no  date        transaction_type  amount
   s1       2012-7-7    opening           500
   s1       2012-8-13   deposit           1000
   s1       2012-7-17   deposit           400
今、私は次のクエリを持っています
select  month(r.date),
  sum(case when (month(r.date))='7' and r.transaction_type='opening' and r.transaction_type='deposit' then r.amount else '' end )as debit 
from receipt r 
where r.account_no='s1'
しかし、それは私に次のような出力を与えています:
month  debit 
7      0
なぜこの出力が得られるのか誰にも教えてもらえますか?
編集
数字の代わりに月の名前を配置したい場合、その方法