A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Two lists



 
 
Thread Tools Display Modes
  #1  
Old May 21st, 2004, 04:18 AM
Galsaba
external usenet poster
 
Posts: n/a
Default Two lists

I have two tables.
tblZip is a list of all ZIP codes. it has 3 fields: State, City, and ZIPcode
tblSchools is a list of schools. it has two fields: SchoolName and ZIPcode
I want to create a query that wil have 4 fields:
State, City, ZIPCode, CountSchool.
CountSchool will show how many schools each ZIP has.
If there is no school in a particular ZIP the CountSchool will have the value
0.

Thanks

Joe
  #2  
Old May 21st, 2004, 05:45 AM
PC Datatsheet
external usenet poster
 
Posts: n/a
Default Two lists

Create a query that includes both tables. Join the tables on zipcode. Double
Click on the join line to change the type of join. Change it to the one that
says "include all records from your State, City, ZipCode table and ......". Pull
down State, City and ZipCode from the State, City, ZipCode table and SchoolName
from the other table. Click on the Sigma Button on the tool bar (looks like a
capital E) and change the query to a totals query. Under SchoolName, use the
drop down list and change Group By to Count. Run the query and you will get what
you want.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications

www.pcdatasheet.com


"Galsaba" wrote in message
...
I have two tables.
tblZip is a list of all ZIP codes. it has 3 fields: State, City, and ZIPcode
tblSchools is a list of schools. it has two fields: SchoolName and ZIPcode
I want to create a query that wil have 4 fields:
State, City, ZIPCode, CountSchool.
CountSchool will show how many schools each ZIP has.
If there is no school in a particular ZIP the CountSchool will have the value
0.

Thanks

Joe



  #3  
Old May 21st, 2004, 01:16 PM
Ed Robichaud
external usenet poster
 
Posts: n/a
Default Two lists

Or to get the results that they asked for: group by [Zip] and count
[SchoolName]
-ed

"PC Datatsheet" wrote in message
link.net...
Create a query that includes both tables. Join the tables on zipcode.

Double
Click on the join line to change the type of join. Change it to the one

that
says "include all records from your State, City, ZipCode table and

.......". Pull
down State, City and ZipCode from the State, City, ZipCode table and

SchoolName
from the other table. Click on the Sigma Button on the tool bar (looks

like a
capital E) and change the query to a totals query. Under SchoolName, use

the
drop down list and change Group By to Count. Run the query and you will

get what
you want.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications

www.pcdatasheet.com


"Galsaba" wrote in message
...
I have two tables.
tblZip is a list of all ZIP codes. it has 3 fields: State, City, and

ZIPcode
tblSchools is a list of schools. it has two fields: SchoolName and

ZIPcode
I want to create a query that wil have 4 fields:
State, City, ZIPCode, CountSchool.
CountSchool will show how many schools each ZIP has.
If there is no school in a particular ZIP the CountSchool will have the

value
0.

Thanks

Joe





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:05 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.