Thursday, March 22, 2012

Creating a table

I have a recordset that consists of among other things a list of values and
dates over the next 12 months, I want to display these dates in a table
ie
Jan Feb Mar Apr May Jun etc
12 80 120 5 65 56 etc
The months are on a 12 month rolling table, how would i achieve this,
perhaps using a case statement or ?
thanks in anticipation
JohnYes, I would do that to. Due to the fact that there will be no more
month (names) in the future this should be an appropiate solution. If
the tables is VERY big and the values seldom change in that table and
the query time must be fast you should thing about (if they are
aggregatable) using AS for this. This could speed up your performance
and let you (with the help of a time dimension) give you the possibilty
to aggregate the values fast from different views.
HTH, jens Suessmeyer.|||Can you give me some pointers of how to acheive this please ?
"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1137772267.696338.62730@.g49g2000cwa.googlegroups.com...
> Yes, I would do that to. Due to the fact that there will be no more
> month (names) in the future this should be an appropiate solution. If
> the tables is VERY big and the values seldom change in that table and
> the query time must be fast you should thing about (if they are
> aggregatable) using AS for this. This could speed up your performance
> and let you (with the help of a time dimension) give you the possibilty
> to aggregate the values fast from different views.
> HTH, jens Suessmeyer.
>|||Sure, do you need information for AS or the setbased solution ? For the
set based solution it would be interesting to get some DDL and sample
data from your database. http://www.aspfaq.com/5006, otherwise a
generic solution would be
SELECT
CASE MONTH(DateColumn)
WHEN 1 THEN SUM(SomeValue) END As January (...)
HTH, jens Suessmeyer.

No comments:

Post a Comment