March 10, 2006 at 12:47 pm
I know this is easy but I want to turn the data as a column
SELECT
[$0-$50]= SUM(CASE WHEN SHARE.BALANCE BETWEEN 0 AND 50 THEN SHARE.BALANCE END )
,[$51-$500]= SUM(CASE WHEN SHARE.BALANCE BETWEEN 51 AND 500 THEN SHARE.BALANCE END )
,[$501-$1000] = SUM(CASE WHEN SHARE.BALANCE BETWEEN 501 AND 1000 THEN SHARE.BALANCE END )
FROM SHARE
Output
$0-$50 $51-$500 $501-$1000
2459892.9900 33024764.5000 47472588.2900
I want it turned the other way
$0-$50 2459892.99
$51-$500 33024764.50
$501-$1000 47472588.29
Thanks in advance
Peter
March 10, 2006 at 12:51 pm
on christmas eve only. no special wishes during the year.
_/_/_/ paramind _/_/_/
March 10, 2006 at 1:02 pm
SELECT
SUM(BALANCE),
CASE WHEN BALANCE BETWEEN 0 AND 50 THEN '0-50'
WHEN BALANCE BETWEEN 51 AND 500 THEN '51-500'
WHEN BALANCE BETWEEN 501 AND 1000 THEN '501-1000'
ELSE 'above 1000'
END AS Category
FROM MAX.dbo.tblVertrag
GROUP BY
CASE WHEN BALANCE BETWEEN 0 AND 50 THEN '0-50'
WHEN BALANCE BETWEEN 51 AND 500 THEN '51-500'
WHEN BALANCE BETWEEN 501 AND 1000 THEN '501-1000'
ELSE 'above 1000'
END
10 cents to paypal account paramind@ars-data.de
_/_/_/ paramind _/_/_/
March 10, 2006 at 1:05 pm
Nice job thanks
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply