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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Oracle Query table joins

 
Ranch Hand
Posts: 102
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I have a table TableA with 6 columns(col1,col2,col3,col4,col5,col6) and there is an other table TableB with 5 columns (colA, ColB(typeID), ColC, ColD, ColE). I need to fetch the col2 ...Col6 from tableA by joining with TableB. I would have to

  • join col2 from TableA with colB from TableB and again

    join col3 from TableA with colB from TableB

    join col4 from TableA with colB from TableB

    join col5 from TableA with colB from TableB


  • Each of the column from TableA needs to be joined with same column (colB) in TableB.Here the typeid value will be different for each of the col types in TableAe The colB is a type id and hence col2, col3,col4, col5 are different types, hence they are kind being joined with colb. I need a query which will fetch all the values of col2, col3,col4, col5 and the colc value based on each type in the same query. I tried writing the query. But could not fetch all the values in a single query.I need to fetch the values for all the field in TableA using a single Query.



    To fetch the associated value for col3, i need to write the below query

    similarly for col4 the below query

    Is there a way I can use a single query to fetch all the 3 col values. I know we can use union function and join the above three queries. But I wanted to know if there is a single query that I can use i.e


    In the above case, joining the fields seems to be an issue.

    Any help on this is much appreciated.
     
    Willie Smits can speak 40 languages. This tiny ad can speak only one:
    Smokeless wood heat with a rocket mass heater
    https://woodheat.net
      Bookmark Topic Watch Topic
    • New Topic