1. 程式人生 > >mysql 查詢出某個欄位的值不為空的語句

mysql 查詢出某個欄位的值不為空的語句

1.不為空

select * from table where id <> "";

select * from table where id != "";

2.為空

select * from table where id ="";

select * from table where isNull(id);

具體情況具體分析,如果欄位是char或者varchar型別的,使用id=""可以的;

如果欄位是int型別的,使用isNull會好些。