mysql... compare and match items in same column I have a column full of server names. For example;

LouServer01
VgsServer01
LouServer02
VgsServer02


I need/want to be able to create a query that can match those two names based on everything after Lou/Vgs and give me something that looks like this: 

Louisville  | Vegas
____________|____________
LouServer01 | VgsServer01
LouServer02 | VgsServer02
Here is the query you need 

SELECT
    Louisville.name LouisvilleServer,
    Vegas.name VegasServer
FROM
(
    SELECT name,SUBSTR(name,LOCATE('0',name)) num FROM servers
    WHERE LEFT(name,LOCATE('0',name)-1)='LouServer'
) Louisville
INNER JOIN
(
    SELECT name,SUBSTR(name,LOCATE('0',name)) num FROM servers
    WHERE LEFT(name,LOCATE('0',name)-1)='VgsServer'
) Vegas
ON Louisville.num = Vegas.num;


Here is a sample table

mysql&gt; use test
Database changed
mysql&gt; DROP TABLE IF EXISTS servers;
Query OK, 0 rows affected (0.05 sec)

mysql&gt; CREATE TABLE servers
    -&gt; (
    -&gt;     id INT NOT NULL AUTO_INCREMENT,
    -&gt;     name VARCHAR(20),
    -&gt;     PRIMARY KEY (id),
    -&gt;     KEY (name)
    -&gt; );
Query OK, 0 rows affected (0.13 sec)

mysql&gt; INSERT INTO servers (name) VALUES
    -&gt; ('LouServer01'),('VgsServer01'),
    -&gt; ('LouServer02'),('VgsServer02');
Query OK, 4 rows affected (0.01 sec)
Records: 4  Duplicates: 0  Warnings: 0

mysql&gt; SELECT * FROM servers;
+----+-------------+
| id | name        |
+----+-------------+
|  1 | LouServer01 |
|  3 | LouServer02 |
|  2 | VgsServer01 |
|  4 | VgsServer02 |
+----+-------------+
4 rows in set (0.00 sec)

mysql&gt;


Here is the query you need executed

mysql&gt; SELECT
    -&gt;     Louisville.name LouisvilleServer,
    -&gt;     Vegas.name VegasServer
    -&gt; FROM
    -&gt; (
    -&gt;     SELECT name,SUBSTR(name,LOCATE('0',name)) num FROM servers
    -&gt;     WHERE LEFT(name,LOCATE('0',name)-1)='LouServer'
    -&gt; ) Louisville
    -&gt; INNER JOIN
    -&gt; (
    -&gt;     SELECT name,SUBSTR(name,LOCATE('0',name)) num FROM servers
    -&gt;     WHERE LEFT(name,LOCATE('0',name)-1)='VgsServer'
    -&gt; ) Vegas
    -&gt; ON Louisville.num = Vegas.num;
+------------------+-------------+
| LouisvilleServer | VegasServer |
+------------------+-------------+
| LouServer01      | VgsServer01 |
| LouServer02      | VgsServer02 |
+------------------+-------------+
2 rows in set (0.00 sec)

mysql&gt;


Give it a Try !!!