[thelist] mysql error using select to update

Bob Meetin bobm at dottedi.biz
Tue Jan 13 19:55:49 CST 2009


ah - we're getting closer to that pat on the back, but no seegars yet.  
See here:

mysql> select @attribs := attribs from jos_content where id="118";

+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| @attribs := 
attribs                                                                                                                                                                                                                                   
|
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| show_title=0
link_titles=0
show_intro=0
show_section=0
link_section=0
show_category=0
link_category=0
show_vote=0
show_author=0
show_create_date=0
show_modify_date=0
show_pdf_icon=0
show_print_icon=0
show_email_icon=0
language=
keyref=
readmore= |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select attribs from jos_content where id=110;

+---------+
| attribs |
+---------+
|         |
+---------+
1 row in set (0.00 sec)

mysql> update jos_content set attribs = @attribs where id = 110;
Query OK, 0 rows affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 1

mysql> select attribs from jos_content where id=110;
+---------+
| attribs |
+---------+
|         |
+---------+
1 row in set (0.00 sec)

mysql> SHOW VARIABLES LIKE '%attribs%';
Empty set (0.00 sec)

mysql>

====>>>> me thinks that the attribs for id 110 should have taken on the 
attribs of 118 but no dice ; is it losing connection, dropping the 
variable?  <<<<====

o'ver



Paul Bennett wrote:
> Apologies, my memory != correct.
>
> This is the correct syntax for setting a var in mysql:
>
> mysql> select @myvar := name from accounts where id = "1";
>
> And to use the var:
>
> mysql> update accounts set name = @myvar where id = "4";
>
> If I answered a question correctly that Rudy didn't, I'm pretty sure either
> A) the world is about to end
> B) or this is all a dream and I'm about to wake up
>
> ;)
> Paul
>   



More information about the thelist mailing list