Detecting empty table cell

Hi i want to select all cells that have omega and the img path is not empty. I can list the products from the omega range but its still showing the one with no images… i.e. don’t have a path to the image. am i going about this the right way?

Please point me in the right direction.


SELECT *
FROM `worktops`
WHERE `range` = 'omega'
AND `imgpath` IS NOT NULL

if you have inserted an empty string (i.e. ’ ’ or ‘’) into the cell then that cell would still be returned by an IS NOT NULL search. Is that the case for you?

NULL and empty string are two separate concepts that people mix up a lot.

^^^^ + 1. More specifically, try this:


SELECT *
FROM `worktops`
WHERE `range` = 'omega'
AND (`imgpath` IS NOT NULL AND TRIM(`imgpath`) != '')

simpler even more –

AND imgpath > ''

Nice! :slight_smile: