array[][6];
如何用for循环,处理所有的行的第3列的数值呢???

解决方案 »

  1.   

    二维数组得用两个for循环来处理
      

  2.   

    We can also access arbitrary rectangular slices of an array, or subarrays. An array slice is denoted by writing lower-bound:upper-bound for one or more array dimensions. For example, this query retrieves the first item on Bill's schedule for the first two days of the week: SELECT schedule[1:2][1:1] FROM sal_emp WHERE name = 'Bill';        schedule
    ------------------------
     {{meeting},{training}}
    (1 row)
    If any dimension is written as a slice, i.e. contains a colon, then all dimensions are treated as slices. Any dimension that has only a single number (no colon) is treated as being from 1 to the number specified. For example, [2] is treated as [1:2], as in this example: SELECT schedule[1:2][2] FROM sal_emp WHERE name = 'Bill';                 schedule
    -------------------------------------------
     {{meeting,lunch},{training,presentation}}
    (1 row)希望对你有用,最近很忙,没有时间尝试
      

  3.   

    array_upper(schedule, 1)取出第一维的大小
    取出各维的维度,然后for循环试试SELECT f1[1][-2][3] AS e1, f1[1][-1][5] AS e2
     FROM (SELECT '[1:1][-2:-1][3:5]={{{1,2,3},{4,5,6}}}'::int[] AS f1) AS ss;
    帮助文档上的,应该支持直接下标访问的
    f[i][j]
      

  4.   

    PHP:
    1)
    for($i=0;$i<count($myarray);$i++)echo $myarray[$i][2];
    2)
    foreach($myarray as $value)echo $value[2];over
      

  5.   

    部分功能改用c++实现了……:(
    然后再给postgres处理……这样就可以让postgres直接处理连续下标的数组了……