compare only month part of a date field in the where clause
hi friends i want to select all the records in the table IMRG where the month part in date field IDATE is a particular month.This month is stored in a variable.and is not constant.
select * from IMRG where IDATE +4(2) = var_month
but in above case there is error "field IDATE +4(2) is sunknown "
here var_month stores the month for wich i have to select records from the table.
ihave tried :
select * from IMRG where IDATE like '____var_month__'
but it is not working and giving runtym error as expected.my problem is that the month is stored in a var.
Plz help .
Edited by: achalmehra on Jun 25, 2010 9:54 AM
Try like this:
data: p_idate like imrg-idate. concatenate '____' var_month '__' into p_idate. select * from IMRG where IDATE like p_idate