title: invalid use of group function error for extracting date with max and min
body: <p>I'm trying to execute a query like this:</p>
  
  <pre><code>SELECT MAX(counter), MIN(counter) ,
         my_date IN (SELECT my_date FROM my_table WHERE counter = MAX(counter) )  AS max_Date ,
         my_date IN (SELECT my_date FROM my_table WHERE counter = MIN(counter) ) AS min_Date 
  FROM my_table;
  </code></pre>
  
  <p>and it's giving me the "invalid use of group function" error. what I want to do is to find the date for the maximum counter and then find the date for the minimum counter. Any help!! really appreciate it .. thanks.</p>