how search for a record in multiple tables (1 Viewer)

Terkpeh1990

Registered User.
Local time
Today, 07:29
Joined
Nov 18, 2017
Messages
24
hi
i have five tables namely
team a
team b
team c
team d
team e

a staff can find himself in all the teams .
is there a way that when i query the staff name , the system should be able to open a form showing that staff's name in all the team he is in .

need help please . thanks
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:29
Joined
Sep 21, 2011
Messages
14,287
With the structure you have there, I think you would need to use a union query, that is the same query 5 times, just changing the table name?

I'd have a staff table, a team table and a junction table to link the two.
At a minimum have the team table with a field for team and have each staff member in the table multiple times. Then it would be one query that shows all the teams a staff member is in.

HTH
 

isladogs

MVP / VIP
Local time
Today, 07:29
Joined
Jan 14, 2017
Messages
18,218
Agree with Gasman
You are creating a spreadsheet like structure which doesn't work well in a database

Suggest you read up on normalisation
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:29
Joined
Feb 19, 2002
Messages
43,266
Take a step back and think about what you would have to do if next year you add a sixth team? It won't be a pretty sight.

If you were CitiBank, would you have a separate table for each customer to manage their transactions? Would you have a separate table for each branch office to manage the local employees? The answer is NO a thousand times NO and for the same reason, you wouldn't have individual tables to manage each team.
 

Terkpeh1990

Registered User.
Local time
Today, 07:29
Joined
Nov 18, 2017
Messages
24
thanks guys. guess will have to restructure the tables again
 

Users who are viewing this thread

Top Bottom