Subject | '<>' doesn't pick the index in the where clause |
---|---|
Author | william_yuwei |
Post date | 2004-11-08T03:14:30Z |
Hi,
The following SQL doesn't use the index:
SELECT * FROM CLIENTS
WHERE CLIENT_ID <> 1
but the one below use the correct index:
SELECT * FROM CLIENTS
WHERE CLIENT_ID > 1 OR CLIENT_ID < 1
How come? BTW, I'm using DB WorkBench to see the sql plans.
Best Regards,
William
The following SQL doesn't use the index:
SELECT * FROM CLIENTS
WHERE CLIENT_ID <> 1
but the one below use the correct index:
SELECT * FROM CLIENTS
WHERE CLIENT_ID > 1 OR CLIENT_ID < 1
How come? BTW, I'm using DB WorkBench to see the sql plans.
Best Regards,
William