Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello I am currently developing one application in that I have to insert the logout time of the user
I fire the sql update quey but It update all value with where keyword.
Suppose abc@gmail.com login today and it logout today so Update query is fire but next day abc@gmail.com login at the time of logout I fire the update query so previously record is also updated so how can I solve this problem?
Posted
Comments
Nandakishore G N 8-Jul-13 3:35am    
if you want to maintain each day login and logout info better insert new values according to their respective date instead of update

1 solution

I got your point.
You are doing updations with reference of Email ID.
remenber one thing never do that.

You should update logout time by Latest id of logout table which contains primary key.

So your sql query is like that...:)

SQL
update tableName set Logout=GETDATE() where id in(select max(id) from tableName )
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900