user569322
user569322

Reputation:

Java JDBC UPDATE Add Number?

So let's say I have an int column in MySQL. I want to update that column by adding to it, without running a SELECT query to get the number and add it. Is this possible?

Upvotes: 3

Views: 175

Answers (1)

BVSmallman
BVSmallman

Reputation: 601

 update tablename set field = field + 1 where condition

This is a direct MySql update command to do so. You didn't mention if you were using a specific ORM like Hibernate or anything, but this same concept can be applied in HQL etc.

Upvotes: 4

Related Questions