• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 418
  • Last Modified:

MySQL: Not empty

How can I specify where a table is not empty?  

A table is empty if it is null or if it contains nothing or if it only contains whitespace.
SELECT * FROM `abc` WHERE `xyz` NOT EMPTY

Open in new window

0
hankknight
Asked:
hankknight
1 Solution
 
jimyXCommented:
SELECT * FROM `abc` WHERE (select count(*) from `xyz`) > 0
0
 
hankknightAuthor Commented:
I found that this also works:
SELECT * FROM `abc` WHERE length(xyz)>0

Open in new window

0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now