Michael Monashev <[EMAIL PROTECTED]> wrote on 07/26/2005 04:41:28 PM:

> Hello,
> 
> How to optimize != statement?
> 
> SELECT * FROM table1 WHERE char_255_column != '';
> 
> How  to  fast  select  all  rows,  where CHAR(255) NOT NULL column not
> empty?
> 
> 
> 
> Sincerely,
> Michael,


You could try 

WHERE char_255_column > ''

If the field has any text in it at all, the comparison will be true. Also, 
since this is a ranged comparison, you give the optimizer the opportunity 
to use an index if one is available.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to