sql - How do we select data based on month and year in oracle query -
i have did research , found can done in msql
select * sales month(selldate) = 3 , year(selldate) = 2017 but when tried oracle , returns me
ora-00904: "year": invalid identifier is there way call data based on month , year in oracle query ?
solved
thank , have came out solution
this how did .. :)
select * sales to_char(sell,'mm')='09' , to_char(sell,'yyyy')='2018';
you can use extract month , year date. example
select extract(year current_date), extract(month current_date) dual; it generate result below.
so query posted in question can re-written below.
select * sales extract(month selldate) = 3 , extract(year selldate) = 2017; you can check demo here

Comments
Post a Comment