|
Posted by Danielle on 11/21/05 22:39
I have data like this in a two column temporary table -
ID Age
23586 3
23586 3
23586 2
23586 2
23586 1
23586 1
23586 1
23586 1
23586 1
I need to create a temporary table that look like this:
ID Age1 Age2 Age3 Age4
23586 5 2 2 0
However, what I get is this:
23586 5 NULL NULL NULL
23586 NULL 2 NULL NULL
23586 NULL NULL 2 NULL
Here is the query that I am using...
select managed_object_id, (select count(Age) where Age = 1) As Age1,
(select count(Age) where Age = 2) as Age2,
(select count(Age) where Age = 3) as Age3,
(select count(Age) where Age = 4) as Age4
into #enhancementCount from #enhancements
group by managed_object_id, Age
Where's my mistake?
Thanks-
Danielle
Navigation:
[Reply to this message]
|