August 21, 2007 at 12:50 pm
I apoligize but i forgot i need to qeury 2 tables
table 1
jobid jobname state
______________________________
1 accountant ga
2 sales fl
3 clerk ga
4 repairman tn
table 2
statename stateabbrv
______________________________
Georgia ga
Florida fl
Tennesse tn
I would like to bind data to dropdownlist
Georgia(2)
Florida(1)
Tennesse(1)
where (#) is the total count in that table. sorry Adrienne ..
Thanks agian
August 21, 2007 at 12:57 pm
select state + '(' + cast(count(state) as varchar(2)) + ')'
from theTable
group by state
order by count(state) desc, state
August 21, 2007 at 1:43 pm
i think i figured it out..
select distinct table2.statename, table2.stateabbrv, count(table1.state) as c from
table1 join table2 on table2.stateabbrv = table1.state
group by table2.statename, table2.stateabbrv
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply