名稱列包含空格。我嘗試獲取僅包含名稱的列行,不應返回空值和空值。但返回包含空格的列。我想:返回只包含空值的列,不包含空格
select name,id from details where name is not null;
以上查詢返回的數據中包含空格。如何消除其中包含空白的數據?
名稱列包含空格。我嘗試獲取僅包含名稱的列行,不應返回空值和空值。但返回包含空格的列。我想:返回只包含空值的列,不包含空格
select name,id from details where name is not null;
以上查詢返回的數據中包含空格。如何消除其中包含空白的數據?
嘗試trim
功能:
select name,id from details where name is not null and trim(name) <> '';
這可能會爲你工作。
select name, id
from details
where name is not null and name !=""
謝謝ExDev格式化我的代碼,因爲這是我的第一個貢獻。 下次我會照顧的。 :) –
做你籤這個答案看起來類似於https://stackoverflow.com/questions/6969315/mysql-query-to-return-rows-that-contain-whitespace – Umakanth