我需要 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"