Click here to Skip to main content
15,922,155 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI , I think this a kind of weird question but i have no choice
i had a secnario where i need three columns for
example: broker, cap, shares

select broker,cap,sum(shares) from table
group by broker


I know it is not possible to get the data as above but is there any way i can get rather than using group by or with using group by
Posted
Updated 18-Mar-11 8:54am
v3
Comments
Wendelius 18-Mar-11 14:54pm    
edit: readability modifications

1 solution

Based on your explanation, didn't quite understand what kind of result you would like to have. An example for the original data and the desired result would help. Anyhow, just guessing the need here so have you tried using partitioning. Something like:
SQL
select broker,
   cap,
   sum(shares) over (partition by broker) 
from table
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900