title: Need COUNT from a more complex query
body: <p>I usually use COUNT within a subquery to grab the desired number, but in this case I need a little help as the query contains too many arguments.</p>
  
  <pre><code>SELECT a.[QueueID]
    ,a.[CouponID]
    ,a.[ListingID]
    ,a.[User_ID]
    ,b.[CouponID]
    ,b.[ListingID]
    ,b.[CouponActive] 
    ,b.[CouponExpire] 
    ,b.[IsDeleted]
    ,c.[ListingID]
    ,c.[TypeID]
    ,c.[LevelID]
    ,@passedUserID as User_ID
  
  FROM CouponQueue a
  JOIN Coupon b
      on a.CouponID = b.CouponID
  JOIN Listing c
      on b.ListingID = c.ListingID
  
  WHERE (a.[User_ID] = @passedUserID)
  AND (b.[CouponActive] = 1)
  AND (b.[IsDeleted] = 0)
  AND (b.[CouponExpire] &gt; DATEADD(dd, -1, GETDATE()) OR b.[CouponExpire] IS NULL)
  </code></pre>
  
  <p>So lets say this query returns a result of 7 rows. All I need is this number for my VIEW. So I want to limit the ultimate result to a single row so that in the end I get:</p>
  
  <pre><code>[TotalCount] &lt;-- Field name
  [7] &lt;-- Result
  </code></pre>
  
  <p>But not 7 rows of data.. I just need the count from the above query. Still plugging away and trying to learn. I looked at a few other examples but I haven't found one with all the conditions... which is what's messing me up.  Please help!</p>
  
  <p>Thank you so much!</p>