To preserve records.

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

Guest

Hi!

I have ten big tables each with 5.000 records.
Some only records has data in fields.
But I have a list with about 400 not consecutive numbers of the records ID
to preserve.

If is possible:
1 - I would like to know what is the syntax, only based in ID number, to
delete not listed records; or
2 - I would like to know what is the syntax, only based in ID number, to
append listed records.

Thanks in advance.
an
 
an said:
I have ten big tables each with 5.000 records.
Some only records has data in fields.
But I have a list with about 400 not consecutive numbers of the records ID
to preserve.

If is possible:
1 - I would like to know what is the syntax, only based in ID number, to
delete not listed records; or
2 - I would like to know what is the syntax, only based in ID number, to
append listed records.


Use a query that joins the two tables.

SELECT table.*
FROM table LEFT JOIN preserve
ON table.ID = preserve.ID
WHERE preserve.ID Is Null

will find records in table that are missing in preserve.

SELECT table.*
FROM table INNER JOIN preserve
ON table.ID = preserve.ID

will find records that are in both.

FYI, I think a table with 5,000 records is a small table.
Big tables have a few hundred thousand records and huge
tables are in the million+ range.
 
Ok, MB

Thank you very much.
an

Marshall Barton said:
Use a query that joins the two tables.

SELECT table.*
FROM table LEFT JOIN preserve
ON table.ID = preserve.ID
WHERE preserve.ID Is Null

will find records in table that are missing in preserve.

SELECT table.*
FROM table INNER JOIN preserve
ON table.ID = preserve.ID

will find records that are in both.

FYI, I think a table with 5,000 records is a small table.
Big tables have a few hundred thousand records and huge
tables are in the million+ range.
 

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

Back
Top