细绳:[Name] => google [AF] => 0 [AX] => 2 [AL] => 1 [DZ] => 0 .....
输出:
[AX,2]
[AL,1]
具有 [0] 个条目的国家/地区将被排除在列表中
I have tried using sql but i want for php
Select '[AF,' + LTrim(Cast(Sum(AF) as varChar(5))) + ']'
From Table Where name = 'Andy'
Union
Select '[AS,' + LTrim(Cast(Sum(AS) as varChar(5))) + ']'
From Table Where name = 'Andy'
Union
Select '[AQ,' + LTrim(Cast(Sum(AQ) as varChar(5))) + ']'
From Table Where name = 'Andy'
还有 http://sqlfiddle.com/#!2/42756/5
但我需要在 php