Data not showing (1 Viewer)

coookiemonsterm

New member
Local time
Today, 00:00
Joined
May 11, 2022
Messages
1
Hi there, I have a database setup with a Tickets table and a customers table.
These have a 1 to many relationship and I've attached a screenshot of the tickets table showing how it looks

1652305436349.png



When I'm running a query to show everything from the ticket table, if the Customer_ID is blank, then these don't appear. I have no conditions, no filters, no nothing. Please can someone tell me where I'm going wrong?

1652305484526.png


What the query is showing:
1652305571035.png
 

plog

Banishment Pending
Local time
Yesterday, 19:00
Joined
May 11, 2011
Messages
11,613
Your customer table is acting as criteria. The way you've joined your tables is that you are only showing records that match in each table.

To fix it to what you want, open the query in design view, right click on the line between your two tables, and change the JOIN type such that it shows all records from your Ticket table and just those records in Customers that match.

This is called a LEFT JOIN if you feel like googling it to learn more about SQL
 

plog

Banishment Pending
Local time
Yesterday, 19:00
Joined
May 11, 2011
Messages
11,613
Now that I look closer I see some things you are doing that aren't best practices:

1. Why is TicketNumber not a number? Its stored as text in your table, but its not only called a number but has numeric data in it.

2. Why are you using the GROUP BY in your query? Do you understand what it does? Most likely includingTicketNumber in that query in that way is undoing anything you hope to accomplish with the GROUP BY
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 20:00
Joined
Feb 19, 2002
Messages
42,981
Given what you've shown, and we can't see what tables you have selected so we can't tell if there is a join involved, if the column is empty in the query, it is empty in the table. Why not open the table directly and filter it to find one of the tickets that has no customerID?
 

Users who are viewing this thread

Top Bottom