Hello Evert,

i actually do not know and don't have access to a 4.1 Machine. What you could try is to use the alternative way of testing if a value is NULL:
Maybe the behavior of IS NULL has been changed in 5.0 .

DELETE FROM table1 WHERE condition1='A' AND condition2<=>NULL

Greets
Rocco

Evert wrote:
I'm using MySQL 4.1.21 (on Gentoo). Should this make any difference?


Regards,
  Evert

Rocco wrote:
Hello Evert,

i just entered your example and had no unusal behaviour on MySQL 5.0:


mysql> describe table1;
+------------+------------+------+-----+---------+-------+
| Field      | Type       | Null | Key | Default | Extra |
+------------+------------+------+-----+---------+-------+
| condition1 | char(1)    | YES  |     | NULL    |       |
| condition2 | tinyint(4) | YES  |     | NULL    |       |
+------------+------------+------+-----+---------+-------+
2 rows in set (0.00 sec)


mysql> SELECT * FROM table1;
+------------+------------+
| condition1 | condition2 |
+------------+------------+
| A          |       NULL |
| A          |       NULL |
| A          |       NULL |
| B          |       NULL |
| C          |       NULL |
+------------+------------+
5 rows in set (0.00 sec)

mysql> SELECT count(*) as counter from table1 WHERE condition1='A' and condition2 IS NULL;
+---------+
| counter |
+---------+
|       3 |
+---------+
1 row in set (0.00 sec)

mysql> DELETE FROM table1 WHERE condition1='A' AND condition2 IS NULL;
Query OK, 3 rows affected (0.00 sec)

mysql> SELECT * FROM table1;
+------------+------------+
| condition1 | condition2 |
+------------+------------+
| B          |       NULL |
| C          |       NULL |
+------------+------------+
2 rows in set (0.00 sec)

Maybe check again the Table definition. There is nothing wrong with with Queries you have posted in your message.

Greets
Rocco

Evert wrote:
Hi!

I'm entering the statements exactly as listed in my message (only done a search/replace on table-name).

So SELECT says there are 2 records, but then DELETE does not see those same 2 records... :-/

Is there something like a verbose/debug mode in which I can see more precise why my DELETE doesn't work?

Regards,
  Evert

Aleksandar Bradaric wrote:
Hi,

Query OK, 0 rows affected (0.00 sec)

It  did  not find/delete any rows - please double-check your
conditions  and  make sure you are using the same set as for
the SELECT statement.


Best regards,
Aleksandar








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

Reply via email to