Getting All Records where Particular Column is empty in Access
I am writing a query in Acces开发者_Python百科s where I have to get all the records where a particular column is empty, how I can do this?
This is what I am thinking it should be, but its not working.
SELECT *
FROM TABLE
WHERE PARTICULARCOLUMN = ''
This would handle both empty strings ('') and NULL values in the column.
SELECT *
FROM TABLE
WHERE Nz(PARTICULARFIELD,'') = ''
Try...
WHERE PARTICULARFIELD Is Null
Sample from Web:
SELECT [Table1].[CustomerID], [Table2].[CustomerID]
FROM [Table1] LEFT JOIN [Table2] ON [Table1].[CustomerID] = [Table2].[CustomerID]
WHERE ((([Table 2].[CustomerID]) Is Null));
See: http://www.fabalou.com/access/Queries/isnullquery.asp
In my case, I wanted to find all records with a particular field empty. Not NULL didn't work. This did: WHERE ((Not (table.field)="").
So, to find both the empties and the nulls, just to be sure...
WHERE (((table.field)="" Or (table.field) Is Null)
精彩评论