![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I have the following situation. CREATE TEMPORARY TABLE T2 ...; CREATE TEMPORARY TABLE T3 FROM T1 JOIN T2 ON ...; In the above JOIN, T1 is a permanent table. UPDATE T3 SET T1.field = value WHERE ...; When I execute the above query there are no errors and mysql indicated 2 rows were changed. When I examine T1.field in T3 I find it is correctly changed. When I examine T1.field in T1 it is unchanged. I expected T1.field in T1 to have the new value. Any help would be appreciated. Thank you, Joe |
#3
| |||
| |||
|
|
On 15-10-2011 21:25, Joseph Hesse wrote: Hi, I have the following situation. CREATE TEMPORARY TABLE T2 ...; CREATE TEMPORARY TABLE T3 FROM T1 JOIN T2 ON ...; In the above JOIN, T1 is a permanent table. UPDATE T3 SET T1.field = value WHERE ...; When I execute the above query there are no errors and mysql indicated 2 rows were changed. When I examine T1.field in T3 I find it is correctly changed. When I examine T1.field in T1 it is unchanged. I expected T1.field in T1 to have the new value. Any help would be appreciated. Thank you, Joe You are updating T3, which is a TEMPORARY TABLE.... so, of course, you are nog seeing your changes in T1 Why would the original change, if the copy is altered? I thought that the T1 fields in the join would refer to the original T1 |
#4
| |||
| |||
|
|
On 10/15/2011 02:42 PM, Luuk wrote: On 15-10-2011 21:25, Joseph Hesse wrote: Hi, I have the following situation. CREATE TEMPORARY TABLE T2 ...; CREATE TEMPORARY TABLE T3 FROM T1 JOIN T2 ON ...; In the above JOIN, T1 is a permanent table. UPDATE T3 SET T1.field = value WHERE ...; When I execute the above query there are no errors and mysql indicated 2 rows were changed. When I examine T1.field in T3 I find it is correctly changed. When I examine T1.field in T1 it is unchanged. I expected T1.field in T1 to have the new value. Any help would be appreciated. Thank you, Joe You are updating T3, which is a TEMPORARY TABLE.... so, of course, you are nog seeing your changes in T1 Why would the original change, if the copy is altered? I thought that the T1 fields in the join would refer to the original T1 fields. I found that if I do the UPDATE and JOIN together it works as I want. |
#5
| |||
| |||
|
|
CREATE TEMPORARY TABLE T2 ...; CREATE TEMPORARY TABLE T3 FROM T1 JOIN T2 ON ...; In the above JOIN, T1 is a permanent table. UPDATE T3 SET T1.field = value WHERE ...; When I execute the above query there are no errors and mysql indicated 2 rows were changed. When I examine T1.field in T3 I find it is correctly changed. |
|
When I examine T1.field in T1 it is unchanged. I expected T1.field in T1 to have the new value. |
![]() |
| Thread Tools | |
| Display Modes | |
| |