SQL query: for each state with specific number of sailors <p>I'm starting to learn to write SQL queries. However, I'm still struggling with that. I had to write a query that gives back for each state that has more than 5 sailors the sailor id and the total number of reservations that he has made. The schemas are as following:</p> <p><code>Slr</code> (<code>sid</code>, <code>sname</code>, <code>rating</code>, <code>state</code>) and <code>Reserves</code> (<code>sid</code>, <code>bid</code>, <code>day</code>). </p> <p>Here's my trial:</p> <pre><code>Select slr.state, slr.sid, count(*) From slr left join Reserves on slr.sid=reserves.sid Group By s.state Having count(*) &gt;= 5 </code></pre> <p>I know it's not correct, but what can I change ?</p>