aspose file tools
The moose likes Oracle/OAS and the fly likes which join to use? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Reply Bookmark "which join to use?" Watch "which join to use?" New topic
Author

which join to use?

trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 602
Hello All,

I have below conditions:
I need to join 3 tables b,c,d where b.id=c.id and b.id_nbr = c.id_nbr and
b.id=d.id and b.id_nbr=d.id_nbr and d.state !=1 and
b.flag = 'some_value' and b.id = ? and c.roll_nbr = ?

the row will always be there in tables b and c ,but it's not necessary that the row will be there in table d. Even in that case the query should retrieve the row from tables b,c and do not apply d.state !=1 condition.

Which type of join needs to be used in above case?

Thanks,
Trupti
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26173
    
  66

Trupti,
You can use a subquery that checks for the state being equal to one. Then check that nothing exists in the subquery.


[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: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: which join to use?
 
Similar Threads
pls answer this??
Sybase to Oracle conversion. (SQL)
counting rows after joins varies
SQL Join for two different columns
JPA table JOIN