Solved

MySQL: Not empty

Posted on 2011-03-10
2
377 Views
Last Modified: 2012-05-11
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
Comment
Question by:hankknight
2 Comments
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
ID: 35098567
SELECT * FROM `abc` WHERE (select count(*) from `xyz`) > 0
0
 
LVL 16

Author Comment

by:hankknight
ID: 35210308
I found that this also works:
SELECT * FROM `abc` WHERE length(xyz)>0

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now