PDA

Click to See Complete Forum and Search --> : [Resolved]how to get current the next 2 quartes?


waely
Nov 30th, 2006, 09:54 AM
hi all,
my sql database has dates in this format:
Q106 Q206 Q306 Q406 Q107 Q207 Q307 Q407

how can extract data based on the Current and the Next Two Quarters dynamically (Q406, Q107, Q207) ?

any tips are appreciated.
waely

ganeshmoorthy
Dec 2nd, 2006, 12:44 AM
how are you storing the date values, I mean in which data type. and how do u say current quarter is Q406, is there any logic you have for the continuous quarter numbers...

waely
Dec 2nd, 2006, 05:56 PM
the dates are stored in date format. I meant the fields names are called Q106,Q206 etc... but the data type is date.

thanks

ganeshmoorthy
Dec 4th, 2006, 01:52 AM
You mean, you are storing the dates in different fields itself...strange..but anyhow...to get for 1 quarter then use something like this in your sql statement.......Where Q106 IS NOT Null
'or
....Where IsNull (Q106) = FalseIm assuming for the other quarters this column will be null otherwise you can use Q106 <> ""

waely
Dec 4th, 2006, 08:25 AM
dear ganeshmoorthy. I think we have misunderstanding so let me explain in more details. my table has about 25 fields. Project _D is one of them and also date fields which start from (2004) Q104 -----> (2017)Q417
these fields are in Date format and all have data in them. my problem is to dynamically check for current system date, figure out which quarter we're in then display it along with the next three quarters. for example if I run my report today I should get Q406 and also the next three quartes Q107,Q207,Q307.

hope this is clear.
thanks for your help

ganeshmoorthy
Dec 4th, 2006, 10:09 PM
Waely, Could you post some sample values stored in the Datefields...and the name of the fields

waely
Dec 5th, 2006, 07:59 AM
sorry to waste your time but specification for the report has changed and I don't need to do my report this way.

thank you for your attempts to help me.

ganeshmoorthy
Dec 5th, 2006, 11:56 AM
no probs....