我正在尝试从数据库中选择所有行,其中display='Y'和announcement!=空。如何检查列以确保它包含值?

 $qry = "select *
         from   school
     where  display='Y'
     order by name, announcement, last_update";

最佳答案

$qry = "select *
         from   school
         where  display='Y'
         and (announcement != '' AND announcement IS NOT null)
         order by name, announcement, last_update";

这迎合了空白字段和空字段。

关于php - 如何检查MySQL列以确保其包含值?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/973649/

10-11 05:14