SQL select distinct rows and ignore row if blank

mysql, phpmyadmin

Solution

Simple solution:

SELECT DISTINCT meta_value 
FROM `wp_postmeta` 
WHERE meta_key = "aaa" AND meta_value != "";

Problem

I am using sql query to fetch rows from table. I want to select the rows only with distinct values and if there is no value entered for some row, that row should not be there. ``` SELECT DISTINCT meta_value FROM `wp_postmeta` WHERE meta_key = "aaa"; ``` This is the query I am using, I am getting the distinct rows by this query but also getting the blank row.

Original source