-3

Alright, let's say I have 2 tables.

Table 1 has:

ServerName         |    ServerIP 

Something1         |    192.168.0.1
Something2         |    192.168.0.2
Something3         |    192.168.0.3

Table 2 has:

PlayerName         |    PlayerIP

MyName1            |    192.168.0.1
MyName2            |    192.168.0.1
MyName3            |    192.168.0.2

How can I get all players(table2) that match the ServerIP in table1?

4

3 回答 3

2
select t2.PlayerName 
from 
  table2 t2, table1 t1 
where
  t2.PlayerIP = t1.ServerIP
于 2013-03-07T21:33:08.417 回答
1

Some pseudo SQL..

SELECT table2.playername from table2 JOIN table1 ON table1.serverip = table2.ip

于 2013-03-07T21:32:53.157 回答
1

You can use an inner join

SELECT t2.PlayerName, t1.ServerIP 
FROM Table1 t1
    INNER JOIN Table2 t2 ON t1.ServerIP = t2.IP 
于 2013-03-07T21:33:19.773 回答