Deleting rows that have a NULL in a specific field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a tables with around 1000000 rows and 30 field colums.I need to
delete rows that have NULL value in specific field.Can anyone help me in
this???
 
Hi,

I have a tables with around 1000000 rows and 30 field colums.I need to
delete rows that have NULL value in specific field.Can anyone help me in
this???

Run a Delete query.
**** Back up your Table first.****

Delete TableName.* from TableName Where TableName.[SpecificFieldName]
Is Null;
 
Hi thanks for the response.But I have another issue before deleting.There
are some rows which have NULL value in the same field.I need to keep one row
and the delete the rows that repeat.

Can anyone help me out in this.

fredg said:
Hi,

I have a tables with around 1000000 rows and 30 field colums.I need to
delete rows that have NULL value in specific field.Can anyone help me in
this???

Run a Delete query.
**** Back up your Table first.****

Delete TableName.* from TableName Where TableName.[SpecificFieldName]
Is Null;
 
So you want to delete all rows where some field is null if some other rows
have a value in that field. On what basis do you decide that some other
rows match the row with the null value?

The following should accomplish that step
DELETE *
FROM TABLE
WHERE SomeField Is Null AND
Exists (SELECT *
FROM TABLE as T
WHERE T.SomeField is Not Null AND
T.AnotherField = Table.AnotherField)

After that you want to delete all but one row of the remaining rows that
have the field as null. Again I would guess on the basis of some other
fields containing matching values.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Ramesh said:
Hi thanks for the response.But I have another issue before deleting.There
are some rows which have NULL value in the same field.I need to keep one
row
and the delete the rows that repeat.

Can anyone help me out in this.

fredg said:
Hi,

I have a tables with around 1000000 rows and 30 field colums.I need to
delete rows that have NULL value in specific field.Can anyone help me
in
this???

Run a Delete query.
**** Back up your Table first.****

Delete TableName.* from TableName Where TableName.[SpecificFieldName]
Is Null;
 
Back
Top