mysql distinct values without empty string and NULL
问题 How to retrieve mysql distinct values without empty string value and NULL value SELECT DISTINCT CON.EMAILADDRESS AS 'E-MAIL' FROM STUDENT INNER JOIN CONTACT CON ON STUDENT.CONTACT_ID = CON.ID WHERE (CON.EMAILADDRESS IS NOT NULL OR CON.EMAILADDRESS !=' '); But in output still getting empty e-mails too. Can't figure out what wrong I am doing. 回答1: Try this: SELECT DISTINCT CON.EMAILADDRESS AS 'E-MAIL' FROM STUDENT AST INNER JOIN CONTACT CON ON AST.CONTACT_ID = CON.ID WHERE length(trim(CON