-2

配列に整数値しかない array_to_string 関数からの合計結果が必要です。

SELECT
    state_name,
    "ST_CODE" ,
    dist_name ,
    "DIST_CODE",
    subdist_name,
    "SUBDIST_CODE",
    array_to_string(array_agg(distinct jan_sale::numeric), ',') as super
FROM village_details_new , aw
WHERE
    "ST_CODE"::integer=3
    AND village_details_new.aw_code::integer = aw.aw_code::integer
group by
    "SUBDIST_CODE",
    state_name,
    "ST_CODE" ,
    dist_name ,
    "DIST_CODE",
    subdist_name
order by "SUBDIST_CODE"

合計が必要です

sum(array_to_string(array_agg(distinct jan_sale::numeric), ',') as super) 

しかし、それは機能していません助けてください........

"Punjab";"03";"Gurdaspur";"0301";"Dhar Kalan";"0301001";"10.1620708"
"Punjab";"03";"Gurdaspur";"0301";"Pathankot";"0301002";"8.7883687"
"Punjab";"03";"Gurdaspur";"0301";"Gurdaspur";"0301003";"0"
"Punjab";"03";"Gurdaspur";"0301";"Batala";"0301004";"0"
"Punjab";"03";"Gurdaspur";"0301";"Dera Baba Nanak";"0301005";"5.6477731"
"Punjab";"03";"Kapurthala";"0302";"Bhulath";"0302001";"6.6241262"
"Punjab";"03";"Kapurthala";"0302";"Kapurthala";"0302002";"12.6775959"
"Punjab";"03";"Kapurthala";"0302";"Sultanpur Lodhi";"0302003";"3.1599889"
"Punjab";"03";"Kapurthala";"0302";"Phagwara";"0302004";"3.3310623,8.7898848"
"Punjab";"03";"Jalandhar";"0303";"Shahkot";"0303001";"14.2610899"
"Punjab";"03";"Jalandhar";"0303";"Nakodar";"0303002";"14.2610899"
4

1 に答える 1

0
sum(distinct jan_sale)::numeric as super
于 2013-03-08T17:24:14.780 に答える