SQL SERVER 2008 Select statement
<p>I have a little issue that i'm trying to resolve. I'm working on a function in VB6, using SQL SERVER 2008 for storage. Here is my issue....</p>

<p>I enter data for a client, ClientID, ClientTask, TaskID, FromDate, ToDate in tblClientInformation.</p>

<p>So let's say I enter client data as such:</p>

<pre><code>ClientID  ClientTask  TaskID   FromDate   ToDate
177       Acct        21       7/28/2016  8/3/2016
179       Acct        21       7/28/2016  8/4/2016
</code></pre>

<p>So here's my issue - I have only 2 spot open for this TaskID. So before I enter any one of these records I check the count like this...</p>

<pre><code>Select ClientID from tblClientInformation where taskID=21 and FromDate&gt;='7/28/2016'
</code></pre>

<p>In this case I'd get a count of 2. However my issue comes up when I someone tries to add another records on 7/29/2016 (my from date is always today) so in this case the system would do this....</p>

<pre><code>Select clientId from tblClientinformation where taskID=21 and FromDate&gt;='7/29/2016' 
</code></pre>

<p>But now it's showing up as no records, since the FROMDATES in SQL SERVER are all before 7/29/2016 (as can be seen in my table data). But I want to make sure that when I enter a client for FROMdate = 7/29/2016, there is no ClientID's in between the FromDate and ToDate. So basically if I try to add a client today on 7/29/2016 - it should show me 2 clientID's since 7/29/2016 is in between the FromDate and ToDate. </p>