I am trying to figure out how to write this as a better query.
Current thinking: (each field has a count of records for that State)
Select AL__c,AK__c, etc FROM Account WHERE...;
and then somehow transform that into a list where each field (label or api name) becomes a value.
Want I want in the end is a two dimensional set with all my state values in it: Example:
State, Account
AL, 200
AK, 15
This will be shown on a visualforce page as a table.
Edit : Idea! How about something like this? I am getting a "Initial term of field expression must be a concreaet sObject: list" error.
selectedAccount = '001S000000qTmDxIAK';
map <string,string> mapStates = new map<string,string>();
list <Account> accStates = new list<Account>(
[Select AL__c,AK__c FROM Account WHERE ID = :selectedAccount]);
mapStates.add('AL', accStates.AL__c);
mapStates.add('AK', accStates.AK__c);
Map<String, List<Account>>()
?