• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

which join to use?

 
Ranch Hand
Posts: 647
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author & internet detective
Posts: 42160
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trupti,
You can use a subquery that checks for the state being equal to one. Then check that nothing exists in the subquery.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic