Re: [PHP] Join question [solved]



On Nov 29, 2007 11:17 PM, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
On Fri, 2007-11-30 at 14:00 +1100, Chris wrote:
Out of curiosity, what SQL server (and version) are you using? I
currently have MySQL 5.0.33 on my dev box and I had no problem with the
query I gave you. Perhaps it's a version issue. There really shouldn't
be a problem updating a table that also occurs in the select query since
the select query should take place before the insert.

He wasn't doing an insert/select, he was doing an update with two tables
joined together.

He was doing an update/select and an insert/select. And the query I sent
performed the insert/select without problem on my system. A similar
query would have done the update/select. The fact that the select
portion required a join doesn't change anything.

<copy>

I thought that --

UPDATE user1 u1, user2 u2
SET u1.login = u2.login, u1.password = u2.password
WHERE u1.username = u2.username

-- would work, but it don't.

Wrong query for either of the needs :)

Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...........................................................

--

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



Rob,

The version difference is probably right on the nose. If I
remember correctly, you couldn't do that in the long-popular 3.23,
which *gasp!* is still used by some web hosts, believe it or not.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.
.


Quantcast