Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Brittney10
Posting Yak Master
154 Posts |
Posted - 2010-10-20 : 13:43:32
|
This is a bit difficult to explain...I get monthly data and have this monthly data back to June. I want to take the average of the monthly data for every month and dump it inot a table. I have my queries to get the monthly avg of the data. However I would like my table to have the monthly avg and the person's name associated with the data. For example. NAME.....Jun2010.....July2010......Aug2010John.......5.3.........5.6...........6.7Jane.......4.6.........7.8...........6.3David......1.2.........2.4...........5.6However, the from month to month a person may be added or removed. I want the table to be based off of the most current month's data (AUG)So how do i execute these three insert into queries and only input data from previous months that are in August's month? If I execute the queries seperately I get...NAME.....Jun2010.....July2010......Aug2010John.......NULL.........NULL.........6.7Jane.......NULL.........NULL.........6.3David......NULL.........NULL.........5.6NULL.......NULL.........1.3..........NULLNULL.......NULL.........3.3..........NULLNULL.......NULL.........5.5..........NULLNULL.......1.2......... NULL.........NULLNULL.......1.3......... NULL.........NULLNULL.......3.2......... NULL.........NULLThanks for the help in advance! |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-10-20 : 13:47:57
|
didnt understand which value corresponds to whom for previous months. can you elaborate?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
Brittney10
Posting Yak Master
154 Posts |
Posted - 2010-10-20 : 15:32:53
|
That's it, my names and values change from month to month. How do i insert everything on the correct line when i do an insert into? |
 |
|
|
|
|