Re: Making a Variable from different tables with Matching Dbfields?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
>
>  Your  post made perfect sense to me about the INNER JOIN , I looked it up
>> but it is not returning the AdminID, maybe my syntax is wrong?
>>
>> $query =  "SELECT admin.AdminID , workorders.AdminID
>>         FROM admin
>>             INNER JOIN
>>         workorders
>>             ON  AdminID(admin, workorders)
>>         WHERE admin.UserName =   '".$_SESSION['user']."' ";
>>
>
> The syntax is wrong.
>
> inner join workorders using (adminid)
> ^^
> only works if both tables are using the same field name, the db will expand
> it into the syntax below. Here you just need to specify the fieldname to
> join on (ie the common one).
>
> or
>
> inner join workorders on (admin.adminID=workorders.adminID)
> ^^
> if the field names are not named the same, eg:
>
> select * from
> comments
> inner join users on (comments.user_id=users.id)
>
> Well I tried both ways and still cannot get it to pick up the AdminID,

$query"SELECT admin.AdminID , workorders.AdminID FROM admin INNER JOIN
workorders on AdminID WHERE admin.UserName = 'tmiller' "$result""$row""
$SortBy"WorkOrderID DESC"$Page"1"$PerPage"30"$StartPage"0"$sql"SELECT
admin.AdminID , workorders.AdminID FROM admin INNER JOIN workorders ON
AdminID(admin, workorders) WHERE admin.UserName = 'tmiller' "$Total"0"

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux