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 |
|
DENIZ3E
Yak Posting Veteran
56 Posts |
Posted - 2005-11-23 : 19:36:21
|
| HI,I HAVE GOT TWO VIEW. (you know view is slow and my rows>100.000SELECT TUR='SI',STOK,WEEK,AMOUNT FROM FT_001_SISELECT TUR='SA',STOK,WEEK,AMOUNT FROM FT_001_SAI WANT TOTUR STOK WEEK1 WEEK2 .... WEEK53 --- ------ ----- ----- -------SI A SUM(SI_AMOUNT)SA A SUM(SA_AMOUNT) FA A SUM(SA_AMOUNT)-SUM(SI_AMOUNT)DA A (SUM(SA_AMOUNT)-SUM(SI_AMOUNT)) + ("week< week1 sum(SUM(SA_AMOUNT)-SUM(SI_AMOUNT)) |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2005-11-23 : 20:26:34
|
| Hi DenizeThis is called a cross tab query. Search this site for "CrossTab" or read this--I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|