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

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

 



Terion Miller wrote:
I'm not sure what you mean by trim the posts, please explain so I can spare folks from redundant text.

Before you post, remove any text that you're not referencing (in this case I removed my suggestion).

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)

You have to use the full tablename (or alias) and the field name.

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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