Re: [PHP] Join question [solved]

2007-12-01 Thread Daniel Brown
On Nov 30, 2007 10:00 PM, tedd [EMAIL PROTECTED] wrote:
 At 2:00 PM +1100 11/30/07, 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.
 
 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.


 Yes, that was true. But considering that it no longer worked, I moved
 on. I still have no clue as to why four months ago the code ran and
 now it doesn't -- other than the host upgraded. But, I don't see how
 that could have affected things.

 As for MySQL version, it's now 3.23.58 -- but I don't know what it
 was before the upgrade -- could have been the same. I dunno.

 Thanks for the interest.

 Cheers,

 tedd

 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com


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



It actually sounds like they may have downgraded.  MySQL 4.x and
5.x shouldn't have a problem with the query, but 3.23 probably won't
do it properly.  If it's a cPanel host, they may have an old version
of cPanel still running on the server, which would include the 3.23
option.  If that is, in fact, the case jump ship.  This will only
be the first of many problems.

And on a side note, wasn't 3.23 the first REAL stable version of
MySQL accepted at large for production use?  I think I recall playing
around with 2.x, but it seems to me that, for the longest time,
everyone was on 3.23.  Am I perhaps simply having a premature senior
moment?

Happy December, by the way.

-- 
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.

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



Re: [PHP] Join question [solved]

2007-11-30 Thread tedd

At 9:52 AM -0500 11/30/07, Daniel Brown wrote:

On Nov 29, 2007 11:17 PM, Robert Cummings [EMAIL PROTECTED] wrote:

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


Bingo!

You guys know you're stuff.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Join question [solved]

2007-11-30 Thread tedd

At 2:00 PM +1100 11/30/07, 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.


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.



Yes, that was true. But considering that it no longer worked, I moved 
on. I still have no clue as to why four months ago the code ran and 
now it doesn't -- other than the host upgraded. But, I don't see how 
that could have affected things.


As for MySQL version, it's now 3.23.58 -- but I don't know what it 
was before the upgrade -- could have been the same. I dunno.


Thanks for the interest.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Join question [solved]

2007-11-30 Thread Wolf
 tedd [EMAIL PROTECTED] wrote: 
 Hi gang:
 
 I found why the JOIN didn't work for me in this instance, which was I 
 needed to create a third table and JOIN what I needed in that table 
 from the other two.
 
 My problem was that I was trying to alter one of the tables in the 
 JOIN. While that might be possible it didn't appear so in my current 
 problem.
 
 Thanks for letting me bounce ideas off you peoples.
 
 Cheers,
 
 tedd

Glad you found an answer tedd, I was going to start digging through my old 
MySQL stuff and see what I could dig up, it's been a couple of years since 
doing any DB work that needed any of that.   Looks like the language and fun 
have changed since then!

Gotta love improvements.

Wolf

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



Re: [PHP] Join question [solved]

2007-11-30 Thread Daniel Brown
On Nov 29, 2007 11:17 PM, Robert Cummings [EMAIL PROTECTED] 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.

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



Re: [PHP] Join question [solved]

2007-11-29 Thread tedd

Hi gang:

I found why the JOIN didn't work for me in this instance, which was I 
needed to create a third table and JOIN what I needed in that table 
from the other two.


My problem was that I was trying to alter one of the tables in the 
JOIN. While that might be possible it didn't appear so in my current 
problem.


Thanks for letting me bounce ideas off you peoples.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Join question [solved]

2007-11-29 Thread Robert Cummings
On Thu, 2007-11-29 at 18:43 -0500, tedd wrote:
 Hi gang:
 
 I found why the JOIN didn't work for me in this instance, which was I 
 needed to create a third table and JOIN what I needed in that table 
 from the other two.
 
 My problem was that I was trying to alter one of the tables in the 
 JOIN. While that might be possible it didn't appear so in my current 
 problem.

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.

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



Re: [PHP] Join question [solved]

2007-11-29 Thread Chris



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.


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.


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

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



Re: [PHP] Join question [solved]

2007-11-29 Thread Robert Cummings
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