1つのオプションはTO_CHARを使用します :
select electrcityUsage, waterUsage
from monthlyBill
where accountNumber = '211' and
to_char(billing_date, 'MM-YYYY') = '12-2012'
これは、SQL Serverではなく、実際にOracleを使用していることを前提としています。
2012が必要な場合 および2011 次に、先に進んで、WHEREに別の条件を追加します。 句。 EXTRACTを使用する可能性があります この場合:
select electrcityUsage, waterUsage
from monthlyBill
where accountNumber = '211' and
extract(month from billingDate) = 12 and
extract(year from billingdate) in (2011, 2012)