Mike Gifford pressed the little lettered thingies in this order...

> Hi Chris,
> I think you are onto something here..  However, this has produced another
> problem.
> Boget, Chris wrote:
> >  > UPDATE
> >  > WLPbib, WLPpublisher,WLPprofile,WLPbib2profile
> > I think you can only update one table at a time...
> > I could be wrong, though...
> I seperated this out into 3 update commands.  However, the WHERE statement
> is hanging now:
>  Database error:
>  Invalid SQL:
>  WLPpublisher
>  SET
>  WLPpublisher.publisherID = ''
>  WLPbib.bibID = '32' AND
>  WLPbib.publisherID =  WLPpublisher.publisherID
>  MySQL Error: 1109 (Unknown table 'WLPbib' in where clause)
>  Please contact the webmaster and report the exact error message.
>  Session halted.
> I can understand that MySQL is getting a bit upset because I am referring
> to fields like WLPbib.bibID when the table hasn't been specifically
> referenced in the query.

If you do not list a table in the UPDATE parameter, you cannot 
reference that table from anywhere else within your query. The same is 
true of SELECT statements - you cannot reference a table that is not 
listed in the FROM clause. The same is true of UPDATE and many 
other commands.  There's a table selection parameter for most SQL 
queries (at least those that actually query), and you cannot point to 
tables later in your query that are not listed.

In other words, you cannot tell it to "update table1 where table2 = ..." If 
you haven't told it to do an action (update in this case) on table2, it's 
going to wonder what the heck those tables have to do with each other 
and exit with an error.  This is an oversimplification of what "really" 
happens, but this message is way too short to go into that in any detail.

You should either pour through the documentation section at 
mysql.com or get the book "MySQL" by Paul DuBois.  The docs may 
be difficult to get through for newbies, but they are precise and contain a 
lot of info.  The book on the otherhand starts at the beginning and holds 
your hand into the more difficult aspects. The book even goes into 
details about how MySQL works that makes it so that you can't do what 
you are attempting above.

Christopher Ostmo
Innovative Application Ideas
Meeting cutting edge dynamic
web site needs since the 
dawn of Internet time (1995)

Business Applications:

Open Source Applications:

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to