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 |
|
HalaszJ
Yak Posting Veteran
59 Posts |
Posted - 2009-09-27 : 07:16:12
|
| I have a table that has all my drives in it that are part of my SAN I need to be able to figure out the disk size by the raid group they are in, i.e, if they are raid 5 add up the total amount of drives space, and subtract the size of one drive since it there for recovery purpose only.Here is my query below.select count(drivenumber) 'total drives' , sum(drivesize) 'drive size' , raidgroup 'raid group'from SANgroup by raidgroupmy results aretotal drives | drive size | raid group--------------------------------------9 | 4127.4 | null--------------------------------------5 | 2293 | 5--------------------------------------1 | 458.6 | nullwhat i want is, the second item on the list should be (5 * 458.6) - 458.6 if it is raid 5can someone help? this should be pretty easy, i just have been staring at it too long. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-09-27 : 07:32:32
|
CASE RaidType WHEN 5 THEN SUM(DriveSize) - MIN(DriveSize) ELSE SUM(DriveSize) END AS [Drive size] N 56°04'39.26"E 12°55'05.63" |
 |
|
|
HalaszJ
Yak Posting Veteran
59 Posts |
Posted - 2009-09-27 : 08:23:51
|
| thank you very much sir, that did it |
 |
|
|
|
|
|