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 |
|
SunnyDee
Yak Posting Veteran
79 Posts |
Posted - 2005-05-27 : 14:29:44
|
| Hello everyone:I have a table that looks like this:Order Type Cust AppCount Percent1 AB Smith 51 AB Smith 21 AB Smith 81 AB Jones 151 AB Ryan 121 AB Ryan 5How can I have the percent column total the app count? I.E. For Smith the Percentages should be 33.33%, 13.33%, 53.33%. For Jonesthe percentage should be 100%, etc. Any help is appreciated. |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-05-27 : 14:34:48
|
[code]Select order, type, cust, appCount, percent = convert(money,appCount)/convert(money,(Select sum(AppCount) From myTable where order=A.order and type=A.type and cust=A.cust)From myTable A[/code]Corey Secret Service Agent: Mr. President, you're urinating on me.President Lyndon Johnson: I know I am. It's my prerogative. |
 |
|
|
|
|
|