在mysql中,查詢某字段為空時,不可用 = null,而是 is null,不為空則是 is not null。
正確寫法如下:
select
*
from
[
table
name
]
where
[
column
name
]
is
null
;
select
*
from
[
table
name
]
where
[
column
name
]
is
not
null
;
錯誤寫法:
select
*
from
[
table
name
]
where
[
column
name
]=
null
;
select
*
from
[
table
name
]
where
length([
column
name
])=0;