List:General Discussion« Previous MessageNext Message »
From:Jorge Renato Machin Ibarra Date:March 19 1999 1:07am
Subject:Could you
explain it?
View as plain text  
We did:


mysql> desc umbLigasxUsr;
+-----------+-------------+------+-----+---------+-------+
| Field     | Type        | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| Nombre    | varchar(15) |      |     |         |       |
| Padre     | varchar(15) |      |     |         |       |
| idUsuario | varchar(15) |      | MUL |         |       |
| URL       | varchar(60) |      |     |         |       |
| min       | char(1)     |      |     | N       |       |
| hide      | char(1)     |      |     | N       |       |
+-----------+-------------+------+-----+---------+-------+
6 rows in set (0.02 sec)

mysql> select Nombre, Padre, idUsuario, url, min, hide, if
(Nombre=Padre,0,1) as orden from umbLigasxUsr where
idUsuario='dinosaurio' order by Padre, orden, Nombre;
+--------------+-------------+------------+---------------------+-----+------+-------+

| Nombre       | Padre       | idUsuario  | url                 | min |
hide | orden |
+--------------+-------------+------------+---------------------+-----+------+-------+

| Buscador     | Buscador    | dinosaurio | http:www.umbral.com | N   |
N    |     0 |
| Buscador_uno | Buscador    | dinosaurio | http:www.umbral.com | N   |
N    |     1 |
| Busqueda     | Buscador    | dinosaurio | http:www.umbral.com | N   |
N    |     1 |
| Diccionario  | Diccionario | dinosaurio | http:www.umbral.com | N   |
N    |     0 |
| Tumbaburros  | Diccionario | dinosaurio | http:www.umbral.com | N   |
N    |     1 |
+--------------+-------------+------------+---------------------+-----+------+-------+

5 rows in set (0.01 sec)

mysql> UPDATE umbLigasxUsr set Nombre=if(Padre=Nombre,'Libro',Nombre),
Padre='Libro' where Padre='Diccionario';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select Nombre, Padre, idUsuario, url, min, hide, if
(Nombre=Padre,0,1) as orden from umbLigasxUsr where
idUsuario='dinosaurio' order by Padre, orden, Nombre;
+--------------+----------+------------+---------------------+-----+------+-------+

| Nombre       | Padre    | idUsuario  | url                 | min |
hide | orden |
+--------------+----------+------------+---------------------+-----+------+-------+

| Buscador     | Buscador | dinosaurio | http:www.umbral.com | N   |
N    |     0 |
| Buscador_uno | Buscador | dinosaurio | http:www.umbral.com | N   |
N    |     1 |
| Busqueda     | Buscador | dinosaurio | http:www.umbral.com | N   |
N    |     1 |
| Libro        | Libro    | dinosaurio | http:www.umbral.com | N   |
N    |     0 |
| Tumbaburros  | Libro    | dinosaurio | http:www.umbral.com | N   |
N    |     1 |
+--------------+----------+------------+---------------------+-----+------+-------+

5 rows in set (0.01 sec)

mysql> UPDATE umbLigasxUsr set
Padre='Diccionario',Nombre=if(Padre=Nombre,'Diccionario',Nombre) where
Padre='Libro';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select Nombre, Padre, idUsuario, url, min, hide, if
(Nombre=Padre,0,1) as orden from umbLigasxUsr where
idUsuario='dinosaurio' order by Padre, orden, Nombre;
+--------------+-------------+------------+---------------------+-----+------+-------+

| Nombre       | Padre       | idUsuario  | url                 | min |
hide | orden |
+--------------+-------------+------------+---------------------+-----+------+-------+

| Buscador     | Buscador    | dinosaurio | http:www.umbral.com | N   |
N    |     0 |
| Buscador_uno | Buscador    | dinosaurio | http:www.umbral.com | N   |
N    |     1 |
| Busqueda     | Buscador    | dinosaurio | http:www.umbral.com | N   |
N    |     1 |
| Libro        | Diccionario | dinosaurio | http:www.umbral.com | N   |
N    |     1 |
| Tumbaburros  | Diccionario | dinosaurio | http:www.umbral.com | N   |
N    |     1 |
+--------------+-------------+------------+---------------------+-----+------+-------+

5 rows in set (0.01 sec)


As you can see, the field "Nombre" on the last result table doesn't
change the word "Libro" on row 4 for the word "Diccionario". Could you
explain it? I think I'm doing everything right!!! By the way, I'm using
MYSQL 3.22.14b.

Thank you very much!



Thread
Could youexplain it?Jorge Renato Machin Ibarra19 Mar
  • Could youexplain it?Michael Widenius19 Mar
  • Re: Could youexplain it?Jorge Renato Machin Ibarra19 Mar