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 |
|
sradez
Starting Member
6 Posts |
Posted - 2007-07-31 : 16:11:47
|
| Hi all,i have a table which has date and count as columnCan you please...help me write a query for it.date | type | count10/07 | A | 7011/07 | A | 5012/07 | A | 50 11/07 | B | 6012/07 | B | 5013/07 | B | 4011/07 | C | 5012/07 | C | 6013/07 | C |6014/07 | A | 50i need to write a sp such that..if user sends date and @ndays(no. of days) as parameter say 11/07 and 3thenout puttype 11/07 12/07 13/07A 50 50 B 60 50 40 C 50 60 60Thanks..Regards,sradez |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-07-31 : 16:17:08
|
| search for pivot here_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-01 : 02:31:36
|
| or read about Cross-tab reports in sql server help fileMadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-08-01 : 02:34:26
|
How many column will there ever be at maximum? 31? One month?If so, make the sp static and not dynamic! Always return 31 days numbered 1-31 and hide the columns you don't want in the front-end application and rename the headers. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|