Hi Evert, all!

Evert Meulie wrote (re-ordered):
Michael Stassen wrote:
Evert wrote:
Hi all!

Who can tell me why the following does not work...?

When I do:
SELECT COUNT(*) AS counter FROM table1 WHERE condition1 = 'A' AND
condition2 IS NULL;

it returns:
+---------+
| counter |
+---------+
|       2 |
+---------+

Then I do:
DELETE FROM table1 WHERE condition1 = 'A' AND condition2 IS NULL;

it returns:
Query OK, 0 rows affected (0.00 sec)

But... when I give a
SELECT COUNT(*) AS counter FROM table1 WHERE condition1 = 'A' AND
condition2 IS NULL;

How come the 2 records did not get deleted...?

>>
What you have shown us is perfectly valid SQL that should produce the
desired results.  Your mysql version (4.1.21) should make no
difference.    [[...]]


I got it to work! :-)
And all I did was replacing "IS NULL" with "= '0000-00-00 00:00:00'" in
the DELETE-statement...

Does anyone have an explanation for this...?

I don't.

I completely agree with Michael: The queries you showed, both using "IS NULL", should work the way you expected (in your original posting).

So this either is a bug, or there is some other difference involved.

What just comes to my mind:
Did you run your statements from the same connection, or from different ones ? I think of settings that control the handling of out-of-range values, like "TRADITIONAL mode" in 5.0 - could they differ for the SELECT and the DELETE ?


If you can make a reproducible test case from this, then please file a bug - "WHERE conditions" must work the same way in all SQL statements for which they are applicable (SELECT, DELETE, and UPDATE).


Regards,
Joerg

--
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com

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

Reply via email to