Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you get fields with null value and values to show on query

Status
Not open for further replies.

torf66

Programmer
Jun 10, 2003
43
0
0
US
I have a question. In a query how do you get a field that has null values but also may have a value in it to show everything on a query. For example I have the tables/fields listed below. I want to list by using a query the Locker ID/EmpLastName/EmpFirstName. In Table1
EmployeeID is null or does not have a default value. When
I run the query I get nothing because EmployeeID in Table1
does not have any value associated with it to look to Table2
EmpID. I cannot put into Table2 a 0 for Unknown so that if I put a default value in Table1 for the EmployeeID of 0.
How can I get my query to list the Locker ID/EmpLastName/EmpFirstName
when there are null or no values in EmployeeID?

Table1 has these fields
Locker ID(Key)
EmployeeID


Table2
EmpID
EmpLastName
EmpFirstName
 
Try
Code:
Select *
From Table1 LEFT JOIN Table2 ON Table1.ID = Table2.ID
 
Where would I put your suggestion, can you give me the steps of how to apply the logic you provided.
Thanks,
Todd
 
Hi!

If you're using the query grid, having both tables within the grid, right click the relationship between them, select "Join Properties" and select "Include ALL records from table2 and only...".

This should produce a query like the one Golom presented. (If not, toggle the relationship type to "Include ALL records from table1....")

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top