File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Repeatable SQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 33130

How about a subquery to determine the rows to update?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Repeatable SQL
jQuery in Action, 3rd edition