title: Declare Loop SQL to count values between dates
body: <p>I have a database of employees and I am trying to count the number of employees I have between specific dates in 10 year increments.  I have my syntax incorrect but I am not very proficient at identifying why this will not run.</p>
  <p><strong>I need the query to produce the following:</strong></p>
  <p>12 employees were hired between 1970 and 1980</p>
  <p>19 employees were hired between 1980 and 1990</p>
  <p>etc.</p>
  <p><a href="https://i.stack.imgur.com/3wvF4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3wvF4.png" alt="enter image description here" /></a></p>
  <p>I keep getting this error:
  <a href="https://i.stack.imgur.com/qQ6Zn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qQ6Zn.png" alt="enter image description here" /></a></p>