I have two tables, one table is called queuelist and the other is call information. In the queuelist table, it simply lists the different identifiers. I am trying to get the "clientID" from this table and match it with the "ID" in another table that contains all the information and displays it on the page. Here's what the tables look like:
Table - queuelist
ID | clientID ------------- 1 | 589 2 | 254 3 | 486
Table - Information
ID | Name | Phone -------------------- 256 | Bob | 5551231234 486 | Jack | 5551231234 589 | Jill | 5551231234
This is what they call table binding, you should use a query like this:
SELECT i.ID, i.Name, i.Phone FROM `queuelist` AS q LEFT JOIN `info` AS i ON ( q.clientID = i.ID );
I use aliases for shorter notation in the above query (queuelist becomes q, and information becomes i), and then sets the connection condition (bit between ON ()) as the clientID from the queuelist table should match the ID in the information table.
See http://dev.mysql.com/doc/refman/5.0/en/join.html for details.
You need to use inner join
select * from queuelist as ql inner join info as i on ql.clientID = i.ID
Although you might want to replace * with specific field names, for example,
select ql.clientID, i.fieldname FROM....
Well, I don't see any difficulty using JOIN.
SELECT * FROM queuelist JOIN info ON clientID = info.ID WHERE queuelist.ID = 2
"Where" will be another option.
SELECT Name, Phone FROM queuelist,info WHERE clientID = ID
Assuming you only want a name and phone