Re: Select & Inner Join Question
| From: | Hugh Bothwell | Date: | Mon, 06 Aug 2001 16:06:59 +0000 |
| Subject: | Re: Select & Inner Join Question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-11095@lists.php.net to get a copy of this message | ||
"Steve Fitzgerald" <sf@mnetsys.com> wrote in message
news:20010806143400.26016.qmail@pb1.pair.com...
> I'm trying to display a summary list of calls with one attribute being
> CallType. I have CallType and CallTypeID defined in a table name
calltypes.
> The problem I am having is taking the output of CallID defined in calls
and
> having the script match the CallTypeID to the CallType.
>
> $display_calls_sql = "SELECT CallID,CallDateTime,CallSubject,CallStatus
FROM
> calls WHERE ContactID = $ContactID";
>
> $display_calltype_sql = "SELECT CallType FROM calltypes INNER JOIN calls
ON
> calltypes.CallTypeID = calls.CallTypeID WHERE CallID = '$CallID'
> ";
$display_calls_sql =
"SELECT "
."CallID, CallDateTime, CallSubject, CallStatus, CallType "
."FROM "
."calls INNER JOIN calltypes ON call.CallTypeID =
calltypes.CallTypeID "
."WHERE "
."ContactID = $ContactID";