select Fields
from TableName
where (select [MM/YYYY] = right(convert(varchar(10),Date_Field_In_TABLE,103),7))
between (select [MM/YYYY] = right(convert(varchar(10),StartDate,103),7)) and (select [MM/YYYY] = right(convert(varchar(10),ENDDATE,103),7))
Note: StartDate , ENDDATE can have formate of dd/MM/yyyy or MM/yyyy doesn't matter.
Member
1 Points
3 Posts
getting a record thet is between 2 dates
May 31, 2013 04:05 AM|angutar|LINK
het guys
my employer wants to have a form that gets you the expenses between 2 dates.
i have looked a lot on the internet but i couldn't find anything that could solve my problem.
because the problem is that the 2 dates only have a specified month and year and both are in a different field.
could you guys please help me?
All-Star
52673 Points
15719 Posts
Re: getting a record thet is between 2 dates
May 31, 2013 04:19 AM|oned_gk|LINK
Suwandi - Non Graduate Programmer
Member
1 Points
3 Posts
Re: getting a record thet is between 2 dates
May 31, 2013 05:23 AM|angutar|LINK
that i know.
but how to be able to only need to specify year and month that come from 2 different date fields
Participant
1181 Points
405 Posts
Re: getting a record thet is between 2 dates
May 31, 2013 05:59 AM|mishra.bhupesh|LINK
Try it:
select Fields
from TableName
where (select [MM/YYYY] = right(convert(varchar(10),Date_Field_In_TABLE,103),7))
between (select [MM/YYYY] = right(convert(varchar(10),StartDate,103),7)) and (select [MM/YYYY] = right(convert(varchar(10),ENDDATE,103),7))
Note: StartDate , ENDDATE can have formate of dd/MM/yyyy or MM/yyyy doesn't matter.
All-Star
52673 Points
15719 Posts
Re: getting a record thet is between 2 dates
May 31, 2013 06:14 AM|oned_gk|LINK
Suwandi - Non Graduate Programmer
Member
1 Points
3 Posts
Re: getting a record thet is between 2 dates
Jun 03, 2013 05:10 AM|angutar|LINK
thanks