This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes JDBC and the fly likes Repeatable SQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Repeatable SQL" Watch "Repeatable SQL" New topic

Repeatable SQL

Prashant Langade
Ranch Hand

Joined: Jul 01, 2009
Posts: 73

I have a requirement like this below.

Table A contains data as below.

id Name Tasks

1 test IA
2 best ABC
3 zest IA
4 east BCD
5 west IA

Now column id is a foreign key referring to column cid in table B

cid Name

1 test
2 zest
3 east
4 west

Now my requirement is to update the table A's "Tasks" column based on the following conditions:
1> when Table A's "id" and Table B's "cid" columns match.
2>only update task column when it contains value as "IA" with ""(blank)

Can any one please help me?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31054

How about a subquery to determine the rows to update?

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Repeatable SQL