-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: laks_win
Message 2 in Discussion

1.Consider a table GFDetail(category, gfyear,amount)

2.Data
1,1990,121212
1,1991,121213
2,1990,232323
2,1991,232324

3.Query

SELECT categoryid,

Max(CASE gfyear WHEN 1990 THEN amount END)) AS 1990,
Max(CASE gfyear WHEN 1991 THEN amount END)) AS 1991,
Max(CASE gfyear WHEN 1992 THEN amount END)) AS 1992,

..........
..........

FROM GFDetail
GROUP BY categoryid;

4.Result

    1990        1991      1992
1  121212     121213  .......
2  232323     232324  .......


Conc.:  Here u have to write a separate CASE for each "header" u want from 
the row to column. The MAX is added as a grouping function, just to display 
the result. In the group by class "categoryid" is used.

Hope, this help.

Regards
Laks.R

_________________________________________________________________
The real power of teamwork. Experience it in real time. 
http://www.microsoft.com/india/office/experience/  Experience MS Office 
System.



-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to