Search (1 Viewer)


Local time
Today, 08:28
Mar 25, 2021

there is 2 table in this DB as an example

I want on the Query to display the unique company Record

but When searching by Category the company related to the category appears

I will Search By Category
But Company Name must be a unique row

How can I do that


  • DB1.accdb
    636 KB · Views: 83

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:28
Feb 19, 2002
You are joining to the cat table but not selecting any columns from it. If you were to select the category, you would see why you are getting multiple rows for a company. There is no error. The query is performing as i would expect it to. YOU need to decide If you want category and if you don't, then don't join to the cat table.

Also, your design is flawed. This is implemented as a 1-many but it seems odd. I would expect the relationship to be many-many given the common English understanding of the word category. That means you need a third table. The cat table you have would be renamed to CompanyCat and a new Cat table would be defined with just the category. The PK of the CompanyCat would be a two column key with both Company and Cat selected so that the combination is unique.

Users who are viewing this thread

Top Bottom