title: Using Select Distinct in Nested subquery
body: <p>I have a select distinct query which identifies a location ID(pk).  But I want to identify the location name for the end user.  I thought a subquery would return it.  But it returns the value of 1.  Instead of the actual location ID when i run the select distinct query separately (25).  Can't seem to figure out why.</p>
  
  <pre><code>SELECT Location.LocationID, Location.Location
  FROM Location
  WHERE (Location.LocationID)=(
      SELECT Count(*) AS UniqueLocations
      FROM (
          SELECT DISTINCT TransactionLocation
          FROM Transactions
          WHERE (Transactions.TransactionActivity) = [Enter Activity] 
           AND (Transactions.TransactionDate) BETWEEN [Enter the start date:] AND [Enter the end date:]
      )
  );
  </code></pre>
  
  <p>Transaction Table</p>
  
  <pre><code>TransactionID(pk)| TransactionEmployee|TransactionActivity|TransactionLocation|Date
  1 | 1001 | 1 | 25 | 01/01/2014
  2 | 1002 | 1 | 25 | 01/02/2014
  3 | 1003 | 1 | 25 | 01/03/2014
  </code></pre>
  
  <p>Location Table</p>
  
  <pre><code>LocationID(pk)|Location Name
  24 | Chicago
  25 | Pittsburgh
  26 | Boston
  </code></pre>
  
  <p>Thanks
  Mike</p>