On 2 March 2010 11:31, Matt Eeles <matt.ee...@navico.com> wrote:
> Hi,
>
>
>
> I'm trying to update a field of the last record using UPDATE and MAX().
> The following query parses ok but updates all records.  Any reason why ?
>
>
>
> UPDATE logs SET Stop = DATETIME('NOW') WHERE (SELECT MAX(ID) FROM logs)

(SELECT MAX(ID) FROM logs) will only ever be false if the maximum id is 0

perhaps you want

'WHERE ID = (SELECT MAX(ID) FROM logs)'

>
>
>
> Thanks,
>
>
>
> Matt.
>

Rgds,
Simon
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to