Okay. Let's say I don't need a join statement. My question then becomes how can I take the userid in a table named calls and translate the userid into a realname listed in user. The current output, in a list format, is the CallID, CallTypeID (listed as an integer), CallDateTime, CallSubject, userid (listed as an integer), and CallStatus. Multiple calls will be listed so I will need to translate multiple userids.
Drew Adams wrote:
One way to write it could be this depending on what database you are using:
SELECT u.realname
FROM user u, calls c
WHERE u.userid = c.userid
AND u.userid = '. $user_id .';
.. but I am not even sure why you need to access "calls" if realname and userid are both in the same table, you could just do this...
SELECT realname
FROM user
WHERE userid = '.$user_id .';
... you only need to do an INNER JOIN if you are looking for information that is in two separate tables.