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 |
chandan_joshi80
Starting Member
30 Posts |
Posted - 2008-06-19 : 05:49:20
|
I have data likeJune 13500.00 22000.00 1400.00 .00 7100.00July 1500.00 2000.00 1000.00 .00 7600.00but i want to display it according to financial year :March 0 0 0 0April 0 0 0 0May 0 0 0 0June 13500.00 22000.00 1400.00 .00 7100.00July 1500.00 2000.00 1000.00 .00 7600.00How it will possible chandan Joshi |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-19 : 06:00:31
|
http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx E 12°55'05.25"N 56°04'39.16" |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-19 : 06:02:39
|
SELECT month, sum(col1) AS col1, sum(col2) as col2, sum(col3) as col3, sum(col4) as col4FROM ( {your original query here}UNION ALL select 'march', 0, 0, 0, 0UNION ALL select 'april', 0, 0, 0, 0UNION ALL select 'may', 0, 0, 0, 0UNION ALL select 'june', 0, 0, 0, 0UNION ALL select 'july', 0, 0, 0, 0) AS fgroup by month E 12°55'05.25"N 56°04'39.16" |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-19 : 08:12:25
|
[code]SELECT mnths.Month,ISNULL(q.Field1,0.00),ISNULL(q.Field2,0.00),...FROM(SELECT 'March' AS Month, 1 AS OrderUNION ALLSELECT 'April'AS Month, 2 AS OrderUNION ALLSELECT 'May' AS Month, 3 AS Order....UNION ALSELECT 'February' AS Month,12 AS Order)mnthsLEFT JOIN{yourqueryhere}qON mnths.Month=q.monthcolumnORDER BY mnths.Order[/code] |
 |
|
|
|
|
|
|