-1

I have Table A,Table B,Table C,Table D,Table E

Table A columns are a1,a2,a3
Table B column are a1,b1
Table C column are b1,c1
Table d column are a1,d1
Table e column are d1,e1,e2,e3,e4,e5,e6,e7

NOTE:

I will enter the a1 so I want all a1 related data from the database. where a1 is relate to table b and table d ,b1 is relate to table c,d1 is relate to table e and I also want table e data.

means i want d1,e1,e2,e3,e4,e5,e6,e7,b1,c1 at same time when I enter a1

3
  • Why do people think that obfuscating table and column names make things easier. Also which DBMS are you using? Oracle? Postgres? Commented Jun 26, 2014 at 7:40
  • Did you try a JOIN? Commented Jun 26, 2014 at 7:41
  • Looks like some straight forward joins. Could you please share what you have tried and where you struggle? Commented Jun 26, 2014 at 7:41

2 Answers 2

0

If I understand your question, then you can do a cross-join on the tables. You want something like this,

SELECT d1,e1,e2,e3,e4,e5,e6,e7,b1,c1 FROM
    A, B, C, D, E
WHERE
  A.a1 = B.a1 AND B.a1 = D.a1 AND B.b1 = C.b1 AND D.d1 = E.d1
Sign up to request clarification or add additional context in comments.

Comments

0
select 
   E.d1,E.e1,E.e2,E.e3,E.e4,E.e5,E.e6,E.e7,B.b1,C.c1 
   from A,B,C,D,E 
   where A.a1 = B.a1 
      and B.a1 = D.a1 
      and B.b1 = C.b1 
      and D.d1 = E.d1

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.