如下:
昆明   25.32
大理   30.25
红河   45012
....
...
昆明    45.67
大理    456,89
红河    4521.3
...
...
昆明    45.67
大理    456,89
红河    4521.3
最后得出表
昆明    数字为前三项的和
大理    数字为前三项的和
红河    数字为前三项的和

解决方案 »

  1.   

    select count(昆明) from table
    select count(大理) from table
    select count(红河) from table
      

  2.   

    Select distinct 省市 , sum(count)
    from table1
    group by 省市
      

  3.   

    错了
    应该是:
    select sum(昆明) from table
    select sum(大理) from table
    select sum(红河) from table
      

  4.   

    看来你只能设个计数变量,如i,j,n,每个变量用于一个省市
    然后用for循环从第一条开始判断,
     case '昆明'
       i := i +1;
       num = num + num1;
    .case '大理'
    .... if i =3 and j= 3 and n = 3 then
      exit;
      

  5.   

    只是个算法,想通过一条SQL查出来,难,各位如果有好的想法,我在这里学习了
      

  6.   

    Select 省市 , sum(je)
    from table1
    group by 省市
      

  7.   

    select sheng, sum(zhi) 
    from table1
    group by sheng
      

  8.   

    select sum(昆明) from table  group by 省
    select sum(大理) from table  group by 省
    select sum(红河) from table  group by 省