title: SQL Server INNER JOIN with three tables
body: <p>I have the following table structure :</p>
  
  <p><strong>News</strong> (Id_news, news_name)</p>
  
  <p><strong>Comments</strong> (Id_comment(PK),Id_news(FK), comment)</p>
  
  <p><strong>Replies</strong>(Id_Reply(PK), Id_Comment(FK), reply)</p>
  
  <hr>
  
  <p>I want to get the number of replies to comments in the news.</p>
  
  <p>This is the query I've tried.</p>
  
  <pre><code>SELECT COUNT(*)
  FROM (News INNER JOIN Comments ON News.Id_news = Commnets.Id_Comment)
  INNER JOIN Reply ON Commnets.Id_Comment = Reply.Id_Comment
  WHERE News.Id_news = {0}
  </code></pre>
  
  <p>This this the following situation: I have a web pages with a lot of news, but not all the news have comments and not all the comments have replies. So I need to count if there is any reply in a specific news (e.g. Id_news = 43), to run one code or another.</p>