Hi
> mysql> SELECT prezzo, totale FROM ordini WHERE numordine=1157;
> mysql> UPDATE ordini SET prezzo = prezzo/1.024, totale = totale/1.024
> WHERE numordine>1385 AND dataord<'2003-06-01';
You are selecting data for numordine = 1157, but are updating all records
that have
numordine > 1385. 1157 < 1385. So you are not updating these records.
Best regards, Mikhail.
----- Original Message -----
From: "PaT!" <patrizio@stripped>
To: <mysql@stripped>
Sent: Friday, June 06, 2003 19:00
Subject: UPDATE doesn't work
> Hi
> I'm running MySQL 4.0.13
> MS Windows XP Prof
>
> I've this problem:
> A db with a table called 'ordini'
>
> mysql> desc ordini;
> +-------------+---------------+------+-----+------------+---------------
> -+
> | Field | Type | Null | Key | Default | Extra
> |
> +-------------+---------------+------+-----+------------+---------------
> -+
> | id | int(11) | | PRI | NULL | auto_increment
> |
> | numordine | int(10) | | | 0 |
> |
> | descrizione | varchar(150) | | | |
> |
> | marca | varchar(250) | | | |
> |
> | modello | varchar(250) | | | |
> |
> | generica | varchar(250) | | | |
> |
> | quantita | int(10) | | | 0 |
> |
> | prezzo | decimal(10,3) | | | 0.000 |
> |
> | type | varchar(10) | | | |
> |
> | dataord | date | | | 0000-00-00 |
> |
> | nominativo | varchar(200) | | | |
> |
> | totale | decimal(10,3) | | | 0.000 |
> |
> | fromprev | int(11) | YES | | NULL |
> |
> | ptype | varchar(20) | YES | | NULL |
> |
> | idutente | int(11) | YES | | NULL |
> |
> | codcliente | varchar(8) | YES | | NULL |
> |
> | datamod | date | YES | | NULL |
> |
> +-------------+---------------+------+-----+------------+---------------
> -+
> 17 rows in set (0.00 sec)
>
> I need to update some values in two fields 'prezzo' and 'totale' These
> are the values before the UPDATE
>
> mysql> SELECT prezzo, totale FROM ordini WHERE numordine=1157;
> +--------+--------+
> | prezzo | totale |
> +--------+--------+
> | 6.795 | 6.795 |
> | 13.835 | 13.835 |
> | 17.578 | 17.578 |
> | 62.500 | 62.500 |
> +--------+--------+
> 4 rows in set (0.02 sec)
>
> this is the UPDATE query
>
> mysql> UPDATE ordini SET prezzo = prezzo/1.024, totale = totale/1.024
> WHERE numordine>1385 AND dataord<'2003-06-01';
> Query OK, 1649 rows affected (0.10 sec)
> Rows matched: 1650 Changed: 1649 Warnings: 0
>
> These are the values after the UPDATE
>
> mysql> SELECT prezzo, totale FROM ordini WHERE numordine=1157;
> +--------+--------+
> | prezzo | totale |
> +--------+--------+
> | 6.795 | 6.795 |
> | 13.835 | 13.835 |
> | 17.578 | 17.578 |
> | 62.500 | 62.500 |
> +--------+--------+
> 4 rows in set (0.02 sec)
>
> Why the values didn't update?
> The same query applied on a single row works perfectly.
>
> Any help is appreciated
>
> PaT!
>
>
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=1
>