Application Development and Automation 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: 
Read only

regarding date selction from a range

Former Member
0 Likes
976

hi

i have two fields of table

bedga that is the starting date

endda thats the end date

now suppose begda have the value 01.02.2002

and endda have the value 31.12.9999

now what i have to do i have to write a select query that retrives data from the two dates thats the satrting date as well as the end date

now depending on the data entered by the user the query should pick the record.

suppose user enter starting date as 01.04.2007 and end date as 31.01.2007 then it should look in between the two fielda of the table and pick the record

what i am doing is i am making it as stsrtdate > userenter start date

and end date < user entered end date but it is not picking any records.

please let me know if some thing can ce done

i need record of a financila year from the satrting date and the end date that is ying between the values of these fields

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
935

HI,

In ther where clause you can write the code. ..

WHERE DATE BETWEEN START_DATE AND END_DATE.

Regards

Sudheer

hi

i have two fields of table

bedga that is the starting date

endda thats the end date

now suppose begda have the value 01.02.2002

and endda have the value 31.12.9999

now what i have to do i have to write a select query that retrives data from the two dates thats the satrting date as well as the end date

now depending on the data entered by the user the query should pick the record.

suppose user enter starting date as 01.04.2007 and end date as 31.01.2007 then it should look in between the two fielda of the table and pick the record

what i am doing is i am making it as stsrtdate > userenter start date

and end date < user entered end date but it is not picking any records.

please let me know if some thing can ce done

i need record of a financila year from the satrting date and the end date that is ying between the values of these fields

7 REPLIES 7
Read only

Former Member
0 Likes
936

HI,

In ther where clause you can write the code. ..

WHERE DATE BETWEEN START_DATE AND END_DATE.

Regards

Sudheer

Read only

aabhas_wilmar
Contributor
0 Likes
935

select * from <table> into <itab> where begda >= user_entered_begda and enda is <= user_entered_endda.

regards,

Aabhas

<reward if problem is solved>

Read only

Former Member
0 Likes
935

are u using select options ??if so try this

chk this

select .. where startdate GT <b>s_date-low</b> and enddate LT <b>s_date-high.</b>

Read only

0 Likes
935

try this

select ...... where startdate in <b>s_date</b> and enddate in <b>s_date</b>.

I think this will solve your problem.

<b>Reward if useful</b>

Regards,

Sudheer

Read only

Former Member
0 Likes
935

Hi Ashish,

write...

SEELCT <FIELDS> FROM DBTABLE WHERE BEGDA <= STARTDATE AND ENDDA >= ENDDATE.

This will definitely work,

<b>Reward points for helpful answers,</b>

Regards,

Tejas

Read only

dani_mn
Active Contributor
0 Likes
935

HI,

you are using the reverse logic

DO LIKE THIS

<b> stsrtdate <= userenter start date

and end date >= user entered end date</b>

Regards,

Read only

Former Member
0 Likes
935

Hi,

U have to <b>award points for useful answers</b> and u have to mention it as solved if ur question is solved. Dont forget.

Regards,

Sudheer