Re: Updating the first row which is null



In your (Select top 1) query, your WHERE clause is limiting your results to
only those records where there is no date.
In other words, you're looking through dateless records to find the most
recent one. It's impossible.

When you say "the first one with the Date field null", you're going to have
to find some other way to determine the "first one" since you obviously
can't use the date field to do that.

<recif20002002@xxxxxxxx> wrote in message
news:1144508902.675910.60370@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello

I am trying to update table1 and set a new value with a condition
selecting only the results for the element with the specified ID and
the first one with the Date field null.
The query executes but it doesn t not update the informations. I ve
tried using TOP 1 and spent hours on this query but i can t get it to
work.

UPDATE table1 SET table1.Name = newName
WHERE table1.Date = (SELECT First(table1.Date) FROM table1 WHERE
table1.Date = Null And table1.ID = specifiedID);;

thank you for your help

Updating the first row which is null



.



Relevant Pages

  • Re: Lookup in Query
    ... UPDATE table1 ... I thought the "SET" line in my first query would ... "Tom Ellison" wrote: ... FROM table1, table2 ...
    (microsoft.public.access.queries)
  • Re: "Query must use updateable query" error message
    ... You won't be able to write this in Access SQL syntax. ... UPDATE table1 ... Trying to run the update query results in the "Query must use updateable ... INNER JOIN ((SELECT DISTINCT OrderNr, ...
    (microsoft.public.access.queries)
  • Update statement using multiple tables
    ... I have a question, hopefully an easy one, about updating values in a ... I would like to have a query ... I thought that if i put table2 in the update clause (update table1, ...
    (comp.databases.informix)
  • Re: Update table with SQL
    ... How about using the DCount function? ... aggregate queries in an update query. ... UPDATE TABLE1 ... I have a SQL query that works fine on an SQL server database but not on ...
    (microsoft.public.access.queries)
  • Re: Updating the first row which is null
    ... I am trying to update table1 and set a new value with a condition ... The query executes but it doesn t not update the informations. ... UPDATE table1 SET table1.Name = newName ... Updating the first row which is null ...
    (comp.databases.ms-access)