SQL - Group batch by lowest status

Posted on 2011-04-27
Last Modified: 2012-05-11
It's been a long day and I'm not getting my head around this at the moment.
I have a table with batch numbers and statuses. What I would like to do with SQL is get a result with one row for each batch with the lowest status. See the image below for what I'm getting at.
Does anyone have a suggestion on how I would set this SQL statement up?

Question by:shambalad
    LVL 38

    Accepted Solution

    Select batch, min(status) from table group by batch
    LVL 7

    Author Comment

    LVL 7

    Author Closing Comment

    Thank you.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now