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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 problem with output the result

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-11-17 : 10:24:04
deepak bhardwaj writes "myself deepak . i have a problem with displaying output.i want to the output just like this



3 mths 6 mths 9 mths 1 yr

Google Ad 8 6 3 0

Yahoo Ad, 4 6 3 3

Friend 3 45 3 1

Print Ad 2 3 3 2



here 3 mths etc. is the column name and 8,4,3,2 are the no of hits for perticuler add .
plz give the solution. its urgent
thanks
deepak""

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-11-17 : 11:11:29
Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-17 : 11:33:35
[code]Select 'Google Ad' as Foo, 8 as [3 mths], 6 as [6 mths], 3 as [9 mths], 0 as [1 yr] union all
Select 'Yahoo Ad' as Foo, 4 as [3 mths], 6 as [6 mths], 3 as [9 mths], 3 as [1 yr] union all
Select 'Friend' as Foo, 3 as [3 mths], 45 as [6 mths], 3 as [9 mths], 1 as [1 yr] union all
Select 'Print Ad' as Foo, 2 as [3 mths], 3 as [6 mths], 3 as [9 mths], 2 as [1 yr]
[/code]

Have fun!!

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-18 : 04:40:23
I think you need to read about Cross-tab Reports in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -