Update a given number

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

Guest

In a simplified version, I have a list of 1000 records in a table with fields
Name(text
Need(numeric
Award(text
The Need field is sorted ascending
I want to put the text "A" in the first 300 names

The way I am doing it is to find record 300 and note the Need value
Then I use an Update query with that value entered as <= in the Need field
There must be a cleaner way
Thanks. J
 
UPDATE Table
SET [Name] = "A"
WHERE [Name] IN (
SELECT Top 300[Name]
FROM Table
ORDER BY Need Asc)

This will update more than 300 records if there are ties in the Need field.

Try this on a COPY of your data to see if it gives you the desired results.
 
Thanks
I will now show my freshman status, first I wanted the Award field to be "A", but I can see how that works
But where do I put this code? It looks like SQL. -JB
 
It looks like SQL, because it is SQL.

Open a new query
Click close on the Select tables dialog
Switch to SQL mode (View: SQL View on the menu)

Type or paste the requisite SQL statement into the textbox.
Modify to match your table and field names.

Try to run it. If it gives you a syntax error, then try to figure out what is
wrong with the SQL statement.
 
Back
Top