magento web developer


Manchester based Magento and Zend Framework certified developer.

Check for null and empty strings in one

Today I discovered that you can avoid:

SELECT * FROM table_name WHERE value IS NOT NULL AND value != '';

And instead use:

SELECT * FROM table_name WHERE value > '';

This checks that the value is both not null, and not an empty string in one go. Okay, it’s not as readable, but it’s good for quick queries.
(more…)