my dog learned polymorphism*
The moose likes JDBC and the fly likes assistance with a subselect query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "assistance with a subselect query" Watch "assistance with a subselect query" New topic
Author

assistance with a subselect query

Dave Bosky
Ranch Hand

Joined: Dec 16, 2003
Posts: 72
How can I lookup the 'dept_name' each 'parent_order_id'
when performing a select query?
Will I need to use to use two select queries?

tbl_dept
--------------------------------------
int PK NOT NULL dept_id
int NULL parent_dept_id
char (25) NOT NULL dept_name
char (25) NOT NULL dept_location
--------------------------------------

Regards,
Dave
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

Dave,
Where is parent order id? In another table? If so, you can do a join.


[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
 
wood burning stoves
 
subject: assistance with a subselect query
 
Similar Threads
How do I assign variables with values from a list?
Regular expression - Pattern and matcher
Unable to pass request objects from one page to another
SQL Query - "in" clause vs "="
use a database schema from java using jdbc