So I've got a database that's primarily an asset inventory to put it simply. Each device in the database has ports assigned to it, and most of these ports connect to ports on other devices. I'm trying to build a query that will show every connection between devices (i.e. Device A, port 1, connects to Device B, port 3, etc.). I've got this working for the most part, however I'm getting duplicate entries that I'm not certain how to handle. For example, there's an entry showing that Device A Port 1 connects to Device B port 3, and then another entry showing that Device B port 3 connects to Device A Port 1. I want to make it so if the connection between two devices has already been displayed it won't show the connection again from the other end.
The data is structured as follows: Each individual port has it's own record in tblPorts. This includes a unique ID, IDdevice (the ID of the device the port is on), IDport (the ID of the port that it is connecting to), and then some other information that isn't relevant to the issue at hand.
I built a query (lets call it query1 for simplicity) that grabs the device name, the port ID, and IDport (the ID of the port being connected to). A device with 3 ports will have 3 entries in this query, one for each individual port. Then I built another query (query2) that grabs all the information out of query1 and uses the IDport value to grab information about the device being connected to. As stated before, this is working fine except for the duplicate entries.
So if I understand correctly, I'm looking for a way to hide an entry if the port ID from query1 has been shown already in port ID from query2 or vice versa, but I have no idea how to accomplish this.
Please let me know if any further info or explanation is needed. I apologize if I explained the issue poorly.
Thanks in advance for any help!