darrenhubbard
Technical User
Hi All,
I have the following SQL query:
SELECT aux_total.[Last Occurence], Applications.Application, aux_total.[Server IP], aux_total.[Server Port], aux_total.Protocol, aux_total.[Client IP], aux_total.[Server Total], aux_total.[Client Total], aux_total.[Total Number]
FROM aux_total LEFT JOIN Applications ON ((aux_total.Protocol=Applications.Protocol) And (aux_total.[Server Port]=Applications.[Server Port]) And (aux_total.[Server IP]=Applications.[Server IP])) Or ((aux_total.Protocol=Applications.Protocol) And (aux_total.[Server Port]=Applications.[Server Port]))
ORDER BY [Application];
The idea is I have a table with a server port, protocol and server IP address and the left join "maps" that to an application. However, in certain circumstances, the server ip address is left blank (the "OR" part of the left join) and therefore ANY server IP address with right port and protocol matches to that application. So, the applications table might look like this:
IP Prot Port Application
10.0.0.1 TCP 1100 App1
10.0.0.4 UDP 7 App2
TCP 80 HTTP
And so on. The problem is, if I add an entry like this:
100.100.10.1 TCP 80 WebApp3
then the query doesn't work (ie I want it to match the above to "WebApp3" and any other TCP 80 to HTTP). To be honest, I wasn't expecting the query to work in this situation but I can't figure anyway to fix it!
Thanks for all your help!
TIA,
Darren
I have the following SQL query:
SELECT aux_total.[Last Occurence], Applications.Application, aux_total.[Server IP], aux_total.[Server Port], aux_total.Protocol, aux_total.[Client IP], aux_total.[Server Total], aux_total.[Client Total], aux_total.[Total Number]
FROM aux_total LEFT JOIN Applications ON ((aux_total.Protocol=Applications.Protocol) And (aux_total.[Server Port]=Applications.[Server Port]) And (aux_total.[Server IP]=Applications.[Server IP])) Or ((aux_total.Protocol=Applications.Protocol) And (aux_total.[Server Port]=Applications.[Server Port]))
ORDER BY [Application];
The idea is I have a table with a server port, protocol and server IP address and the left join "maps" that to an application. However, in certain circumstances, the server ip address is left blank (the "OR" part of the left join) and therefore ANY server IP address with right port and protocol matches to that application. So, the applications table might look like this:
IP Prot Port Application
10.0.0.1 TCP 1100 App1
10.0.0.4 UDP 7 App2
TCP 80 HTTP
And so on. The problem is, if I add an entry like this:
100.100.10.1 TCP 80 WebApp3
then the query doesn't work (ie I want it to match the above to "WebApp3" and any other TCP 80 to HTTP). To be honest, I wasn't expecting the query to work in this situation but I can't figure anyway to fix it!
Thanks for all your help!
TIA,
Darren