title: Passing in Week Day name to get nearest date in SQL
body: <p>I'm working on a query that deals with a frequency value (i.e. Mondays, Tuesdays, etc. - Think assignments).</p>
  
  <p>So in my query I currently have a result of</p>
  
  <pre><code>jobId:1, personId:100, frequencyVal: 'Mondays'
  jobId:2, personId:101, frequencyVal: 'Saturdays'
  </code></pre>
  
  <p>What I need is the next the 4 future(or current) dates for the frequencyVal.</p>
  
  <p>So if today is 1/3/2015</p>
  
  <p>I would need my result set to be</p>
  
  <pre><code>jobId:1, personId:100, frequencyVal: 'Mondays', futureDates: '1/5,1/12,1/19,1/26'
  jobId:2, personId:102, frequencyVal: 'Saturdays', futureDates: '1/3,1/10,1/17,1/24'
  </code></pre>
  
  <p>I was looking at the following post:
  <a href="https://stackoverflow.com/questions/18791270/how-to-find-the-nearest-day-of-the-week-for-a-given-date">How to find the Nearest (day of the week) for a given date</a></p>
  
  <p>But that sets it for a specific date.  And I'm looking at this being a web application and I want the dates for the current date.  So if I try to run this query next Tuesday the future dates for <code>jobId:1 would remove the 1/5 and add the 2/2</code>.</p>
  
  <p>Is there a way to pass in a weekday value to get the next nearest date?</p>