简体   繁体   中英

mysql query for check multiple not empty column

I'm want to check multiple not empty columns, something like I did for check multiple empty columns:-

SELECT * FROM users WHERE "" IN(`profilepic2`,`bsector`,`gender`,`first_name`,`sur_name`,`phone`,`hphone`,`countryresd`,`passportnum`,`maritalstatus`,`haddress`,`countryofbus`,`maddress`,`paddress`)

Now I want not empty columns through mysql query.

这应该可行。用您的必填列替换some_col

 SELECT * FROM users WHERE some_col IS NULL OR some_col = " ";

SELECT * FROM users where WHERE some_col!=“” AND some_col不为空;

$fields = mysql_query("SHOW columns FROM mytablename");
while($row = mysql_fetch_array($fields))
{$field_name[] = $row['Field'];
}
for($i=0; $i<sizeof($field_name; $i++;)){`enter code here`
"SELECT * FROM users WHERE '".$field_name[$i]."' IS NULL OR '".$field_name[$i]."' = ''";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM