Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-07-17 : 10:00:38
|
| Nathan writes "Hi SQL team..Here's my question.I have two multiple selection listbox in my form. So the user will give me two list of data. One is a list of cities and other is a list of employer types. I want to be able to select the number of employers for all cities selected for each employer type selected.For example:Cities selected: Boston, Los Angeles, New YorkEmployer Type selected: IT, Hardware, SoftwareI need: IT (15 employers), Hardware (25 employers), etc.My tables:EmployersEmployerId, Name, CityEmployersWithTypeEmployerId, TypeIdEmployerTypesTypeId, TypeThanks a lot for your hlep.Nathan" |
|
|
M.E.
Aged Yak Warrior
539 Posts |
Posted - 2002-07-17 : 11:08:24
|
| select et.type, count(1) as total_employersfrom employertypes et inner join employerswithtype ewt on et.typeID = ewt.type_ID inner join employers e on ewt.employerID = e.employerIDgroup by et.typeThat will find counts for all. For certain employer types include a where statment before the group bywhere et.type in ('IT, Hardware, Software') and e.city in('Boston, Los Angeles, New York ')I haven't had a chance to test it... So post up here the results when you try it-----------------------Take my advice, I dare ya |
 |
|
|
|
|
|
|
|