Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

query two tables for certain condtions (where all these are true)

$
0
0

How can I query against two tables for a specific condition?

To simplify suppose I have two tables; NODES and TESTS.  They both have 2 columns NAME and STATUS.  How can I write a query that can check the following condition:

-NODES name = 'some_node'

-NODES status = 'down'

-TESTS name = 'some_test'

-TESTS status = 'down'

I don't need to join the tables, I just need to run a query that can look for those conditions.

Currently we have a test that monitors both of these items individually:

SELECT TEST.Id, TEST.Name
  FROM TEST
 
  Where
 
  (
 
  (TEST.ID = 16)  AND
  (TEST.Status = 'UP')
 
  )

select Nodes.status, Nodes.name
FROM Nodes

Where
(
 (Nodes.Status = 'UP') AND
 (Nodes.SysName = 'NODE_NAME')
)

But I need a more advanced monitor to tie the two together.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>