0

Hi All,

I have a access database with these columns. USER_ID,COUNT,TIMES

Let say the current record is this:

USER_ID,COUNT,TIMES
STEVE20,24,1.5

Now I want to updated the current count record and times, but before updating I want the old record to be added to the new record. What should be my query?

4
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by renzlo
0

first there shud be an insert query to move ur records to the other table and then an update query

eg.insert into newtablename(col1, col2, col3) select col1,col2,col3 from oldtablename

and then an update query based on userid

update oldtablename set count=value1,times=value2 where user_id="STEVE20"

hope it helps u

0

hi poojav,

thanks for the reply, yes I already knew that, what I am asking is that for example:

From the record from the starting post,

the new record to be inserted is this:
USERID,COUNT,TIMES
STEVE20,10,3.5

the old record is this:
USERID,COUNT,TIMES
STEVE20,24,1.5

The updated record will be:
USERID,COUNT,TIMES
STEVE20,34,5.0

Hope you got it.

1

how about label help? i mean.. get the old value and add that to a label.
example : label 1 for count, and label 2 for times

after that, on insert query just sum it

set count=value1 + '" & label1.Text & "',times=value2 + '" & label2.Text & "' where user_id="STEVE20"

and hide that label, so user can't see it :D

Edited by artemix22

0

yes thanks artemix22, i just thought there's a simple query for that.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.