title: mysql subqueries or join
body: <p>I have 5 tables in my Mysql database with t1 with field name like data,id,cool and 4 other tables with id and data say t2,t3,t4,t5.</p>
  
  <p>I have used join and sub queries  but result i am getting is empty set its not mandatory that all the fields in the t2,t3,t4,t5 tables are populated .t4,t5,t3,t2 can be empty i am using where clause  on data if data column of t1 = t2 = t3 = t4 = t5 if it finds any matching data in any of the table it prints the cool from t1 and id and data from found table if any and if founds the data match in all the table it prints all the table stats like</p>
  
  <pre><code>cool data.t1 id.t1
  cool data.t2 id.t2 
  and so on
  
  
  
  table t1
  
  cool data id
  0    xyz   1
  
  table t2
  
  data id
  xyz   5
  
  table t3
  
  data id
  xyz   4
  
  table t4
  
  data id
  xyz   3
  
  table t5
  
  data id
  xyz   2
  </code></pre>
  
  <p>desired output</p>
  
  <pre><code>cool data id
    0   xyz  1
    0   xyz  4
    0   xyz  3
    0   xyz  5
    0   xyz  2
  </code></pre>
  
  <p>if any of the table is empty say  t5 and t4 than output should be</p>
  
  <pre><code> cool data id
    0   xyz  1
    0   xyz  4
    0   xyz  3
  </code></pre>