I have two tables in my database. The first one, [nodeActivity] has the following two columns ( primary Key = node_name )
node_name | last_updated |
| |
node 1 | 00:00:00 |
node 2 | 00:00:01 |
The second, table called [nodes] has the following columns ( no primary key )
node_name | data | time |
| | |
node 1 | data1 | 00:00:01 |
node 2 | data2 | 00:00:01 |
node 1 | data3 | 00:00:02 |
node 2 | data5 | 00:00:02 |
node 1 | data6 | 00:00:03 |
node 3 | data7 | 00:00:03 |
I want to select only those nodes and data from [nodes], which have a corresponding entry in the [nodeActivity] table.
For example, In the above case, I want to exclude node3 and data7, as node3 is not present in [nodeActivity].
How can the above can be accomplished, in the most efficient manner possible?
1 Answer