Re: Update timestamp with a select

[email protected]
Newsgroups gmane.comp.db.mysql.windows
Message-ID <OFFB7C1042.CA474B61-ON85257145.0015BDE9-85257145.00161EE8@unimin.com>
"Urcid Pliego, Paulo" <[email protected]> wrote on 04/01/2006 03:24:57 
PM:

> Hi, does anyone know if it's possible for a timestamp column to
> automatically update itself when a select is made? We have a
> user/password/roles database that is accessed by Tomcat's j_security 
module
> whenever a user logs into one of our webapps, and I want to know which 
users
> haven't logged in recently so that I can erase their accounts. I would
> appreciate all of your feedback on this one.
> 
> Thanks!
> 
> Paulo Urcid Pliego
> E-Labor Producción DM e IM
> Preserie y Construcción de Equipos
> 
> Volkswagen de México S.A. de C.V.
> Teléfono +52 (222) 2 30 9961
> Fax +52 (222) 2 30 6082
> mailto:[email protected]
> http://www.vw.com.mx
> 

Every SQL standard that I have read does NOT allow for read operations 
(such as SELECT statements) to affect the data being read. It would create 
a very chaotic situation if it were possible to read the same row of data 
twice in a row and get different responses, wouldn't it? 

In order to change a record, you need to try to UPDATE it. The act of 
logging in is sufficient justification for me to run an UPDATE statement 
to change the last login datetime value to something else. Were you just 
trying to get two actions with one statement?

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.