Thread: Min Function
View Single Post
  #8 (permalink)  
Old September 22nd, 2006, 01:31 PM
Jeff Mason Jeff Mason is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

Your 'vch' prefix doesn't indicate the calls column is a varchar, does it?

Assuming not, use a subquery. Try:
Code:
SELECT vchNumberCalls as 'Number of Calls', vchSpecialistName
FROM tblConsumerSpecialists
WHERE vchNumberCalls = (SELECT MIN(vchNumberCalls
                            FROM tblConsumerSpecialists)
but as was pointed out earlier, this could return more than one row if the same minimum value was present in more then one row of the table.

You can't avoid that unless you can define what conditions distigush one row with the same number of calls from another with that same value.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com