473,388 Members | 1,335 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,388 software developers and data experts.

query does not extract records if blank fields are included

Hi all,

Hoping someone can help me with an issue I'm having.

I'm using AccessXP to create a database of U.S. Census records. After
keying the data in, I decided to run a query to create a report for
each domocile address, and the three names that appear at each street
address for the three censii.

After running the query, the report skips over any "address" that
might have an incomplete result (i.e.: 1900 Linden St had people
living there in 1900 and 1920, however since 1910 was vacant, that
address was not included in the report).

Is there a way to allow the query to include addresses with null
values in the query (i.e.: include non-complete records)?

Here is the SQL query that I am using:

SELECT [Street Addresses].[1910 Address], [Street Addresses].[1920
Address], [Street Addresses].[Street Name] AS [Street Addresses_Street
Name], [1920 Census].[street address] AS [1920 Census_street address],
[1920 Census].[street name] AS [1920 Census_street name], [1920
Census].[first name] AS [1920 Census_first name], [1920 Census].[last
name] AS [1920 Census_last name], [1920 Census].relation AS [1920
Census_relation], [1910 Census].[street address] AS [1910
Census_street address], [1910 Census].[street name] AS [1910
Census_street name], [1910 Census].[first name] AS [1910 Census_first
name], [1910 Census].[last name] AS [1910 Census_last name], [1910
Census].relation AS [1910 Census_relation], [1900 Census].[street
name] AS [1900 Census_street name], [1900 Census].[street address] AS
[1900 Census_street address], [1900 Census].[last name] AS [1900
Census_last name], [1900 Census].[first name] AS [1900 Census_first
name], [1900 Census].relation AS [1900 Census_relation], [1910
Census].Race
FROM (([Street Addresses] INNER JOIN [1910 Census] ON ([Street
Addresses].[1910 Address] = [1910 Census].[street address]) AND
([Street Addresses].[Street Name] = [1910 Census].[street name]))
INNER JOIN [1920 Census] ON ([Street Addresses].[1920 Address] = [1920
Census].[street address]) AND ([Street Addresses].[Street Name] =
[1920 Census].[street name])) INNER JOIN [1900 Census] ON ([Street
Addresses].[1910 Address] = [1900 Census].[street address]) AND
([Street Addresses].[Street Name] = [1900 Census].[street name])
WHERE ((([1920 Census].relation)="Head") AND (([1910
Census].relation)="Head") AND (([1900 Census].relation)="Head"))
ORDER BY [1910 Census].Race;

NOTE: address numbers changed between in 1912 so I created a table
called "Street Addresses" to keep track of which 1900/10 address is
equivilent to a 1920 address
Nov 12 '05 #1
1 3654
Try outer joins instead of inner joins, and change the WHERE clause to get
Nulls as well.

Details of both issues in article:
The Query Lost My Records! (Nulls)
at:
http://allenbrowne.com/casu-02.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Robert Marshall" <ro******@hockeyhockeyhockey.com> wrote in message
news:42**************************@posting.google.c om...
Hi all,

Hoping someone can help me with an issue I'm having.

I'm using AccessXP to create a database of U.S. Census records. After
keying the data in, I decided to run a query to create a report for
each domocile address, and the three names that appear at each street
address for the three censii.

After running the query, the report skips over any "address" that
might have an incomplete result (i.e.: 1900 Linden St had people
living there in 1900 and 1920, however since 1910 was vacant, that
address was not included in the report).

Is there a way to allow the query to include addresses with null
values in the query (i.e.: include non-complete records)?

Here is the SQL query that I am using:

SELECT [Street Addresses].[1910 Address], [Street Addresses].[1920
Address], [Street Addresses].[Street Name] AS [Street Addresses_Street
Name], [1920 Census].[street address] AS [1920 Census_street address],
[1920 Census].[street name] AS [1920 Census_street name], [1920
Census].[first name] AS [1920 Census_first name], [1920 Census].[last
name] AS [1920 Census_last name], [1920 Census].relation AS [1920
Census_relation], [1910 Census].[street address] AS [1910
Census_street address], [1910 Census].[street name] AS [1910
Census_street name], [1910 Census].[first name] AS [1910 Census_first
name], [1910 Census].[last name] AS [1910 Census_last name], [1910
Census].relation AS [1910 Census_relation], [1900 Census].[street
name] AS [1900 Census_street name], [1900 Census].[street address] AS
[1900 Census_street address], [1900 Census].[last name] AS [1900
Census_last name], [1900 Census].[first name] AS [1900 Census_first
name], [1900 Census].relation AS [1900 Census_relation], [1910
Census].Race
FROM (([Street Addresses] INNER JOIN [1910 Census] ON ([Street
Addresses].[1910 Address] = [1910 Census].[street address]) AND
([Street Addresses].[Street Name] = [1910 Census].[street name]))
INNER JOIN [1920 Census] ON ([Street Addresses].[1920 Address] = [1920
Census].[street address]) AND ([Street Addresses].[Street Name] =
[1920 Census].[street name])) INNER JOIN [1900 Census] ON ([Street
Addresses].[1910 Address] = [1900 Census].[street address]) AND
([Street Addresses].[Street Name] = [1900 Census].[street name])
WHERE ((([1920 Census].relation)="Head") AND (([1910
Census].relation)="Head") AND (([1900 Census].relation)="Head"))
ORDER BY [1910 Census].Race;

NOTE: address numbers changed between in 1912 so I created a table
called "Street Addresses" to keep track of which 1900/10 address is
equivilent to a 1920 address

Nov 12 '05 #2

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

Similar topics

2
by: lawrence | last post by:
A very strange bug. www.monkeyclaus.org is run by a cms I'm developing. One of types of users we allow is "justTestingTheSite", a type of user I developed to give demo's to prospective clients. The...
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
9
by: MLH | last post by:
I have a table (tblCorrespondence) holding records with fields like , , , , , , , etc... About a dozen 's are defined and I often use queries to extract records of a given . That's pretty easy....
4
by: Macroman | last post by:
MS Access XP, running on Win XP, Processor 2.4Ghz , 512Mb RAM, 40Gb Hard drive Table 1 has 167,000 records and contains the following fields tblone_custID tblone_easting tblone_northing ...
36
by: Liam.M | last post by:
hey guys, I have one last problem to fix, and then my database is essentially done...I would therefore very much appreciate any assistance anyone would be able to provide me with. Currently I...
16
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for...
2
by: Will | last post by:
Hi, I need to handle blank values in a query calculation. I have 636 records at the moment but when I sum over these records the blank fields are not returned. I have looked around here and on...
7
by: nofear | last post by:
I have a table with 2 fields where one has duplicates and the other does not something like this: ID field1 field2 1 A A 2 A B 3 A C...
9
by: Sinner | last post by:
Hi, I have a field name 'USER' in tableMAIN. How do I replace the user names with corresponding user names. I can do that in xl using vlookup but now I'm trying to find a way to do that in...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.