This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes SQL Recursion Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL Recursion Question" Watch "SQL Recursion Question" New topic
Author

SQL Recursion Question

Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181
I could use some help figuring out the sql for a problem. Currently, there are 2 tables:
Domain, which has columns domainID, and parentDomainID. ParentDomainID references another Domain record.
EndUser, which has a column parentDomainID.

I have a procedure where I am looping over domainIDs (variable @currentDomainID). I need to do now is update all EndUser records that are in the currentDomainID or where the any parent of the endUser parentDomainID is the @parentDomainID.

In pseudocode what I need to do is this:

Any help would be appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL Recursion Question
 
Similar Threads
PreparedStatement and 'null' value in WHERE clause
proble in converting ArrayList<String> to ArrayList<Object>
Multi-Record Update
Java Printing
Handling SQL Exception