Need Query to Delete top 100 records from the table

  • Thread starter Thread starter May Q. via AccessMonster.com
  • Start date Start date
M

May Q. via AccessMonster.com

I need a query that will delete the top 100 records from the table, but I'm
getting a syntax error. Here's my code:
DELETE TOP 100 *
FROM FileAA;

thanks,
May
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

DELETE *
FROM FileAA
WHERE EXISTS (SELECT TOP 100 * FROM FileAA WHERE <criteria>)

You need a criteria in the subquery. The question is TOP 100 what? 100
rows that have Dates that ??? 100 rows that have a color that = ???
See? Tables are unordered sets of data. You have to specify what you
want, not just the TOP 100.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA+AwUBQ87D1YechKqOuFEgEQJ8RwCgsa321N2SHUJMBJSDF0LxRcHIPVwAmIgC
qogdoQJ3zCXIejHrY7pSzPQ=
=gmsq
-----END PGP SIGNATURE-----
 
Hi all,
I don't think Access supports "Exists"- but it's the right idea
Maybe

DELETE *
FROM FileAA
WHERE ID IN (SELECT TOP 100 ID FROM FileAA WHERE <criteria>)

DELETE *
FROM FileAA
WHERE EXISTS (SELECT TOP 100 * FROM FileAA WHERE <criteria>)

You need a criteria in the subquery. The question is TOP 100 what? 100
rows that have Dates that ??? 100 rows that have a color that = ???
See? Tables are unordered sets of data. You have to specify what you
want, not just the TOP 100.
I need a query that will delete the top 100 records from the table, but I'm
getting a syntax error. Here's my code:
[quoted text clipped - 3 lines]
thanks,
May
 
Back
Top