Re: UPDATE doesn't work

2003-06-06 Thread Keith C. Ivey
On 6 Jun 2003 at 19:00, PaT! wrote:

 mysql UPDATE ordini SET prezzo = prezzo/1.024, totale = totale/1.024
 WHERE numordine1385 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?

Your update query has WHERE numordine  1385, but 1157 isn't 
greater than 1385.  Why would you expect the values to be updated?

-- 
Keith C. Ivey [EMAIL PROTECTED]
Tobacco Documents Online
http://tobaccodocuments.org


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: UPDATE doesn't work

2003-06-06 Thread Roger Baklund
* PaT!
[...]
 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 numordine1385 AND dataord'2003-06-01';
 ^
This statement only updates rows with numordine1385, your test records have
numordine=1157, which is smaller than 1385... :)

--
Roger


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: UPDATE doesn't work

2003-06-06 Thread Mikhail Entaltsev
Hi

 mysql SELECT prezzo, totale FROM ordini WHERE numordine=1157;

 mysql UPDATE ordini SET prezzo = prezzo/1.024, totale = totale/1.024
 WHERE numordine1385 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! [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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  |  | | -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 numordine1385 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/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



I: UPDATE doesn't work

2003-06-06 Thread PaT!

:-) didn't pay enough attention

Thanks 

PaT!

-Messaggio originale-
Da: Keith C. Ivey [mailto:[EMAIL PROTECTED] 
Inviato: venerdì 6 giugno 2003 19.08
A: [EMAIL PROTECTED]
Cc: PaT!
Oggetto: Re: UPDATE doesn't work

On 6 Jun 2003 at 19:00, PaT! wrote:

 mysql UPDATE ordini SET prezzo = prezzo/1.024, totale = totale/1.024
 WHERE numordine1385 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?

Your update query has WHERE numordine  1385, but 1157 isn't 
greater than 1385.  Why would you expect the values to be updated?

-- 
Keith C. Ivey [EMAIL PROTECTED]
Tobacco Documents Online
http://tobaccodocuments.org





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



UPDATE doesn't work

2003-06-06 Thread PaT!
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  |  | | -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 numordine1385 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/[EMAIL PROTECTED]