>delegates: c(20)
>City: c(20)
>State: c(5)
>
>>delegate, City >Robert Phoenix >Smith Snow Flake >Burns Snow Flake >etc. > Az: Delegates: 3 > >Stevens San Diego >Jerome Los Angeles > Ca: Delegates 2 >etc. >etc. >>
create cursor Politics ; ( Delegates c(20), ; City c(20), ; State c(5) ; ) insert into Politics values('Robert', 'Phoenix', 'AZ') insert into Politics values('Smith', 'Snow Flake', 'AZ') insert into Politics values('Burns', 'Snow Flake', 'AZ') insert into Politics values('Stevens', 'San Diego', 'CA') insert into Politics values('Jerome', 'Los Angeles', 'CA') select State, ; count(*) as nDelegates ; from Politics ; into cursor tmp ; group by 1 select Politics.Delegates, ; Politics.City, ; Politics.State, ; tmp.nDelegates ; from Politics ; join tmp on (Politics.State == tmp.State ) ; into cursor result ; order by 3,2,1