How to check if a filed is in another table?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 tables with a common field "server".

Table A has the following fields:
server
status
comment

I need to create a query based on "status" on table A:

If status = NOK then I need to check if servername (tableA) is in servername
(tableB)

How to do that?
 
In the query add both tables, then link both tables using the server field
(click on the field in one table and then drag it to the field in the second
table) that way you'll get all the cmmon records
Now add the filter to the status field

"NOK"

In SQL it will look like

SELECT [TABLE A].*
FROM [TABLE A] INNER JOIN [TABLE B] ON [TABLE A].server = [TABLE B].server
WHERE [TABLE A].Status ="NOK"
 
Back
Top