I use PostgreSQL database and in one table I have the datetime column edit_user. Some rows are blank, and these rows I would like to delete.
I tried
I believe that your problem is that you're checking for an empty string using double quotes instead of single quotes. Try just changing to:
DELETE FROM table WHERE edit_user=''
To delete rows empty in table
syntax:
DELETE FROM table_name
WHERE column_name IS NULL;
example:
Table name: data ---> column name: pkdno
DELETE FROM data
WHERE pkdno IS NULL;
Answer: 5 rows deleted. (sayso)
DELETE FROM table WHERE edit_user IS NULL;
If you are trying to delete empty spaces , try using =''
instead of is null
. Hence , if your row contains empty spaces , is null
will not capture those records. Empty space is not null and null is not empty space.
Dec Hex Binary Char-acter Description
0 00 00000000 NUL null
32 20 00100000 Space space
So I recommend:
delete from foo_table where bar = ''
#or
delete from foo_table where bar = '' or bar is null
#or even better ,
delete from foo_table where rtrim(ltrim(isnull(bar,'')))='';