Solved link tables in a query (please urgent)

drhassan

New member
Local time
Today, 20:50
Joined
May 24, 2012
Messages
10
Hello everyone

I'm trying to link two tables (table names: add sample + antibiogram data) by a query (query name: Collected antibiogram) in my database (attached) but the showing data is only for one table. I'm not sure how to fix that as I'm still beginner?! Can you help?
 

Attachments

Hello everyone

I'm trying to link two tables (table names: add sample + antibiogram data) by a query (query name: Collected antibiogram) in my database (attached) but the showing data is only for one table. I'm not sure how to fix that as I'm still beginner?! Can you help?
IDSample IDAntibiotic NameResultMethodÏîëå1
112221NorfloxacinR
212221GarenoxacinS
35555CiprofloxacinR
45555DoxycyclineS
55555AzithromycinR
633511MinocyclineS
733511GentamycinR
833511ChloramphenicolR
91DoxycyclineScorrect
102TigecyclineRcorrect
11787777LevofloxacinR
Sample ID is not in the main table, there are 1-6
 
Last edited:
Sample IDSample CodeSample typeSampling DateSpeciesPathogen suspectedAntibiotic NameResult
112221Chicken meat, Cuts up, Chilled08.02.2022BroilersSalmonellaDoxycyclineS
233511Dust06.02.2022BroilersSalmonellaTigecyclineR
478777708.02.2022Broilers
508.02.2022BroilersSalmonella
65555Chicken meat, Cuts up, Frozen09.02.2022BroilersSalmonella
 
Sample IDSample CodeSample typeSampling DateSpeciesPathogen suspectedAntibiotic NameResult
112221Chicken meat, Cuts up, Chilled08.02.2022BroilersSalmonellaDoxycyclineS
233511Dust06.02.2022BroilersSalmonellaTigecyclineR
508.02.2022BroilersSalmonella
There is no Sample ID in the main table, there are 1-6
tables linked by Sample ID, not Sample Code

Code:
SELECT [Add samples].[Sample ID], [Add samples].[Sample type],
 [Add samples].[Sample Code], [Add samples].[Sampling Date],
 [Add samples].Species, [Add samples].[Pathogen suspected],
 [Antibiogram data].[Antibiotic Name], [Antibiogram data].Result
FROM [Add samples]
 LEFT JOIN [Antibiogram data]
 ON [Add samples].[Sample ID] = [Antibiogram data].[Sample ID];
 
Last edited:
you join the two table not by ID (which is autonumber) but by
[Add Samples].[Sample Code] and [Antibiogram Data].[Sample ID].
 

Attachments

You are wonderful guys. I don't know how i missed that. Many thanks
 

Users who are viewing this thread

Back
Top Bottom