xProteuSx Posted December 30, 2008 Share Posted December 30, 2008 I am wondering if there is any sort of 'if' statement for MySQL. What I am trying to do is something that looks like this: SELECT * WHERE column1 !=' ' So basically I want to select rows where column1 is not empty, or null. I know that I can select all rows, then filter them using PHP, but I would really like to do this using MySQL if possible. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/138833-solved-mysql-if-statement/ Share on other sites More sharing options...
trq Posted December 30, 2008 Share Posted December 30, 2008 SELECT * WHERE column1 != '' Quote Link to comment https://forums.phpfreaks.com/topic/138833-solved-mysql-if-statement/#findComment-725958 Share on other sites More sharing options...
corbin Posted December 30, 2008 Share Posted December 30, 2008 Or, if nulls are allowed, you might want to try: SELECT * FROM table WHERE column1 != '' AND colum1 IS NOT NULL; Quote Link to comment https://forums.phpfreaks.com/topic/138833-solved-mysql-if-statement/#findComment-725983 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.