Mysql query update statement

763 views mysql
8

Can someone help me with a sql update query?

So I have this:

db table: packageinfo ( the table has more than 400 users, and each users has a value in listings_count and used_listings_counts

that db table has this 3 important fields:

user_id listings_count used_listings_counts

So what I want is to:

Update listings_count field with the corresponding used_listings_counts value + 5

Any help would be appreciated

answered question

Is that a red-tailed hawk?

1 Answer

3

it seems you need simple update

update packageinfo t1 
inner join packageinfo t2 on t1.user_id =t2.user_id 
set listings_count =used_listings_counts+5

posted this

Have an answer?

JD

Please login first before posting an answer.