Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

compare only month part of a date field in the where clause

Former Member
0 Kudos

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.

like :

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello

Try like this:


data: p_idate like imrg-idate.
concatenate '____' var_month '__' into p_idate.
select * from IMRG where IDATE like p_idate

2 REPLIES 2

0 Kudos

use this code

data itab type standard table of imrg.

select * from IMRG into table itab where IDATE GT '19950601' and IDATE LT '19950630'.

Former Member
0 Kudos

Hello

Try like this:


data: p_idate like imrg-idate.
concatenate '____' var_month '__' into p_idate.
select * from IMRG where IDATE like p_idate