Alex Rivera | Logout

SQL select distinct rows and ignore row if blank

Asked 2012-06-06T10:15:48.107
25

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.

Edit
Report

1 Answer

1
SELECT DISTINCT meta_value
FROM `wp_postmeta`
WHERE meta_key = "aaa"
AND meta_value != "";
answered 2012-06-06T10:19:45.093

Your Answer