Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get child table values from parent query

 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I want to get second(reference) table status using id in first query.

I am calling select * from table1;
this table1 contains one column called referenceid. This reference id details will be there in table2 (id,status,date....etc). At time the of calling select * from table1 I want to get reference id status instedof referenceid.

Please provide any query.
 
Agador Paloi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you want to join table1 with table2 to get a status from table2.
Query would be
SELECT
t2.id ,
t2.status
FROM
table1 t1,
table2 t2
WHERE
t1.id = t2.id


Agad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic