Duplicated date

  • Thread starter Thread starter mohsin via AccessMonster.com
  • Start date Start date
M

mohsin via AccessMonster.com

Hi

It's any function of queries to check then delete the duplicate date in one
field?

-rgds
Mohsin
 
You cannot 'delete' a field, you can delete the WHOLE record, but not a
single field in a record. You can SET a field to a NULL value, though.

If there is 'a', one, duplicate row, there are TWO of them. Unless you have
some means to differentiate them somehow, any SQL statement would affect
BOTH rows.

So, basically, use an UPDATE query that will SET the field with a NULL
value, but construct the WHERE clause so that the criteria would not affect
one of the row, something that may looks a little bit like:

UPDATE myTable
SET myField = NULL
WHERE myPrimarKeyValue <> ( SELECT MAX(a.primaryKeyValue)
FROM myTable AS
a
WHERE a.myField
= myField )



Hoping it may help
Vanderghast, Access MVP
 
Thank you

Michel said:
You cannot 'delete' a field, you can delete the WHOLE record, but not a
single field in a record. You can SET a field to a NULL value, though.

If there is 'a', one, duplicate row, there are TWO of them. Unless you have
some means to differentiate them somehow, any SQL statement would affect
BOTH rows.

So, basically, use an UPDATE query that will SET the field with a NULL
value, but construct the WHERE clause so that the criteria would not affect
one of the row, something that may looks a little bit like:

UPDATE myTable
SET myField = NULL
WHERE myPrimarKeyValue <> ( SELECT MAX(a.primaryKeyValue)
FROM myTable AS
a
WHERE a.myField
= myField )

Hoping it may help
Vanderghast, Access MVP
[quoted text clipped - 4 lines]
-rgds
Mohsin
 
Back
Top