title: retrieving data from three tables using MySQL
body: <p>i am having three tables namely</p>
  
  <p>1)cd_register</p>
  
  <pre><code>|----------------------------------------------------|
  |   username  |  name   |  age   | sex   | dob       |
  |----------------------------------------------------|
  </code></pre>
  
  <p>2)cd_social</p>
  
  <pre><code>|-------------------------------------|
  |   username  |  religion  |  caste   |
  |-------------------------------------|
  </code></pre>
  
  <p>and
  3)cd_professional</p>
  
  <pre><code>|----------------------------------------|
  |   username  | occupation | education   |
  |----------------------------------------|
  </code></pre>
  
  <p>now i'm using this query in mysql but its giving error</p>
  
  <pre><code>SELECT cd_register.name, cd_register.age, cd_register.dob, cd_social.religion, cd_social.caste, cd_professional.profession
  FROM cd_register, cd_social,cd_professional
  WHERE 
  cd_register.sex = 'Male',
  cd_social.religion = 'Hindu',
  cd_social.caste = 'Brahmin',
  cd_professional.occupation = 'Doctor',
  cd_register.username = cd_social.username AND
  cd_register.username = cd_professional.username 
  </code></pre>
  
  <p>now i want to mention that <code>username</code> is the <code>primary key</code> of all the tables. Also
  <code>username</code> of <code>cd_register</code> is <code>foreign key</code> in <code>cd_social</code>. Also
  <code>username</code> of <code>cd_register</code> is <code>foreign key</code> in <code>cd_professional</code>.</p>