Delete duplicates records without data in field name

A

an

Hi!

I would like syntax query for delete duplicates records without data in the
Field1:

Ex:
Id Field1 Field2 Field...
1 abc def ghi
2
2 xxx yyy zzz

Delete all duplicates records (2 in example) where the first field hasn't
data.

Thanks in advance.
an
 
R

Rob Parker

I don't see any duplicates in your sample data. If you are simply wanting
to delete all records where Field1 is null, the SQL is:

DELETE * FROM YourTableName WHERE Field1 Is Null;

HTH,

Rob
 
A

an

In adition:

There are records no duplicates with without data in Field1.
With:
DELETE * FROM YourTableName WHERE Field1 Is Null;
delete all records.

Ex:
Id Field1 Field2 Field...
1 abc def ghi
2
2 xxx yyy zzz
3
4 hhh
5 www

Where the record 3 hasn't data but is not to delete.
in this example I would like delete only the "first" record 2 (where hasn't
data)
Thanks more one time.
an
 
J

John Spencer

DELETE *
FROM YourTableName
WHERE Field1 is Null AND
ID IN (SELECT ID FROM YourTableName as Temp WHERE Temp.Field1 is not null)

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top