473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Sorting Multiple Entries

Okay folks,

I am back with another somewhat weird problem. I have a table that I am
trying to run a query on that has the following fields: City, State, Zip
Code, Population, Households.

The info for the table came from US Census information for 2000, and what I
need is to find the number of times a particular entry repeats. Example: I
want to find the number of times a city name shows up, and the number of
states it shows up in.

I am trying to do this all through the design view in Access, though I would
be willing to try the SQL if someone has a suggestion.

Tarvos{k}
Nov 13 '05 #1
2 1358
Do you mean this?

SELECT tblCityState.City, Count(tblCityState.State) AS CountOfState
FROM tblCityState
GROUP BY tblCityState.City;
Or did you want to list the states as well? Or what did you mean by
"entry"? A family?

Nov 13 '05 #2
Tarvos{k} wrote:
Okay folks,

I am back with another somewhat weird problem. I have a table that I am trying to run a query on that has the following fields: City, State, Zip Code, Population, Households.

The info for the table came from US Census information for 2000, and what I need is to find the number of times a particular entry repeats. Example: I want to find the number of times a city name shows up, and the number of states it shows up in.

I am trying to do this all through the design view in Access, though I would be willing to try the SQL if someone has a suggestion.

Tarvos{k}


I have a SQL suggestion!

tblCensusInfo:
ID AutoNumber
City Text
State Text

1 Salem OR
2 Salem OR
3 Salem OR
4 Salem MA
5 Salem MA
6 Salem NH
7 Amherst NY
8 Amherst MA
9 Amherst OH

tblCensusInfo_Crosstab:
TRANSFORM Count([ID]) AS [The Value] SELECT [City], Count([ID]) AS
[ShowsUp], Count([The Value]) AS NumberOfStates FROM tblCensusInfo
GROUP BY [City] PIVOT [State];

gave:

City ShowsUp NumberOfStates MA NH NY OH OR
Amherst 3 3 1 1 1
Salem 6 3 2 1 3

You could write a second query based on this one that grabs just the
first three fields. Disclaimer: I've never played around with crosstab
queries before so be sure to test this method out thoroughly.

James A. Fortune

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dont bother | last post by:
This is really driving me crazy. I have a dictionary feature_vectors{}. I try to sort its keys using #apply sorting on feature_vectors sorted_feature_vector=feature_vectors.keys()...
13
by: Paul | last post by:
Hi all I have a sorting problem, but my experience with Python is rather limited (3 days), so I am running this by the list first. I have a large database of 15GB, consisting of 10^8 entries...
2
by: Joe | last post by:
Hey, I'm going to give some background on my situation in case anyone can point out a way around my problem altogether... for the problem itself, please skip to the bottom of the post. thanks....
9
by: p0wer | last post by:
Let's suppose I have this sample document: <root> <entry id="1" <date>2003-08-03</date> <param_1>5</param_1> <param_2>10</param_2> </entry> <entry id="2"> ...
3
by: cs_hart | last post by:
I have the following data custID orderNum trackingNum ShipDate I have put these in multiple arrays since I want to redim. For example, the user selects one shipdate and I keep only the entries...
0
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another...
6
by: Dennis Gearon | last post by:
This is what has to be eventually done:(as sybase, and probably others do it) http://www.ianywhere.com/whitepapers/unicode.html I'm not sure how that will affect LIKE and REGEX. ...
4
by: rushik | last post by:
Hello all, I am using structure in my program, and my aim is to sort this structure based on some optimized sorting algo. structure is struct data { int account;
2
by: aschen | last post by:
hi this is my first post on this very fine website but I have used some of the solutions of others posts for problems that i have come across. I have recently been asked to help out with the...
1
by: Totti | last post by:
Hi everyone, I am a newbie to javascript learning it for 2 months now, i am trying to make a sorter who will read english words from the one textbox or datafile and store them in a 2 dimensional...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.