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)