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 |
|
AClb55
Starting Member
3 Posts |
Posted - 2011-07-18 : 09:19:31
|
| [code] ,SUM(CASE ALFA_Grouping WHEN 'S&P 500 Avg' THEN MSF.VALUE/5 ELSE 0 end) as 'Idx1InitFixedAV' ,SUM(CASE ALFA_Grouping WHEN 'S&P 500 Avg' THEN MSF.VALUE/5*INDEX_MARGIN ELSE 0 end) as 'Idx1InitSpreadRate'[/code]The above code does not accomplish whant I am looking for. I want to find away to take the value I am currently getting for 'Idx1InitSpreadRate' and divide it by 'Idx1InitFixedAV'. Doing this will give me the actual value that I want for 'Idx1InitSpreadRate' Thanks for the help. |
|
|
AClb55
Starting Member
3 Posts |
Posted - 2011-07-18 : 09:29:54
|
| Disregard. |
 |
|
|
jcelko
Esteemed SQL Purist
547 Posts |
Posted - 2011-07-18 : 09:39:30
|
| You missed a basic principle of SQL and declarative programming. Everything happens at once, not left to right. There is no "previous" concept. That was sequential file processing. YOu need to write each column expression in a self-contained fashion. Also, you might want to use 5.0 instead of an integer.--CELKO--Books in Celko Series for Morgan-Kaufmann PublishingAnalytics and OLAP in SQLData and Databases: Concepts in Practice Data, Measurements and Standards in SQLSQL for SmartiesSQL Programming Style SQL Puzzles and Answers Thinking in SetsTrees and Hierarchies in SQL |
 |
|
|
|
|
|