Hi everybody I have this table of appointments with three records the main things here are start and end (date start and date end) the dstart, mstart, yend are datepart derived from the field start and yend, mend , dend are datepart derived from end that has became int datatype already after datepart...
what i need to do is to display events per month with the condition that if the event last more than one month or more than the current year it will also display on the month and year of it's entire duration..
my query is this
WHERE mstart=12 AND ystart>=2008 AND mEnd>=1 and yend>=2008
with the query the result would display all three records but if i change the mstart to 1 it should display records 2 and 3 and if i change mstart to 2 it would display only the third records..
If I am not wrong, are you referring to "mend" in this statement?
"but if i change the mstart to 1 it should display records 2 and 3 and if i change mstart to 2"
If that's the case, here is what in my opinion should work for your situation.
declare @mend int = 3
mstart = 12
and ystart >= 2008
and mend >= @mend
and yend >= 2008
If this is not what you are looking for, then I am missing something very badly. I would be glad to help you out, if you are still working on this. If you have resolved yourself. Kudos. have a nice day.