title: How to join three tables with multiple primary key
body: <p>I have three tables as following</p>
  
  <p>Table a (id,name) as primary key</p>
  
  <p>Table b (id,name,country) as primary key,c_id as foreign key</p>
  
  <p>Table c (id) as primary key, another column is type</p>
  
  <p>I would like to select id,name,type from these tables, where country='CA'</p>
  
  <p>MY database is MySQL, I wrote the SQL as following:</p>
  
  <pre><code>select n.activity_date,n.advertiser_id,c.type as type
  from  a JOIN b as n
      on (a.id=b.id,a.name=b.name)
      JOIN c
      on n.c_id=c.id
  where b.country='CA'
  limit 10;
  </code></pre>
  
  <p>The error is </p>
  
  <pre><code>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as n
  on (a.activity_date=d.activity_date,a.advertiser_id=d.advertiser_id)
  JOIN t' at line 2
  </code></pre>