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 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 and Relational Databases
Bookmark "assistance with a subselect query" Watch "assistance with a subselect query" New topic

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?

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

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

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

[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: assistance with a subselect query
jQuery in Action, 3rd edition