+ Reply to Thread
Results 1 to 3 of 3

Thread: Select query retireve smallest number

  1. #1
    Forum Contributor
    Join Date
    07-16-2009
    Location
    Bucharest, Romania
    MS-Off Ver
    MS Office 2007
    Posts
    157

    Select query retireve smallest number

    I have the folowing table:

    DATA TotalCount
    A 0
    B 15
    C 0
    D 2
    E 8

    The field "TotalCount" can contain many duplicates. I to select one record with the smallest number.
    In this case, an example would be:
    A 0

    I tried the folowing query but it returned more than one record:
    SELECT TOP 1 rndnumbers
    FROM query1_qse
    ORDER BY query1_qse.TotalCount ASC;
    Thank you.
    Last edited by Alexander Ceed; 12-29-2011 at 09:47 AM.

  2. #2
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,423

    Re: Select query retireve smallest number

    Perhaps:

    SELECT TOP 1 DATA, TotalCount FROM query1_qse WHERE TotalCount = (SELECT MIN(TotalCount) FROM query1_qse)

  3. #3
    Forum Contributor
    Join Date
    07-16-2009
    Location
    Bucharest, Romania
    MS-Off Ver
    MS Office 2007
    Posts
    157

    Re: Select query retireve smallest number

    Perfect. Thank you.
    Happy holidays to all of excelforum members.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0