sql - select the rows affected by an update -


if have table fields:

int:id_account int:session string:password 

now login statement run sql update command:

update tbl_name set session = session + 1 id_account = 17 , password = 'apple' 

then check if row affected, , if 1 indeed affected know password correct.

next want retrieve info of affected row i'll have rest of fields info.
can use simple select statement i'm sure i'm missing here, there must neater way gurus know, , going tell me (:
besides bothered me since first login sql statement ever written.

is there performance-wise way combine select update if update did update row?
or better leaving simple 2 statements? atomicity isn't needed, might better stay away table locks example, no?

there row_count() (do read details in docs).

following sql ok , simple (which good), might unnecessary stress system.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -