Results 1 to 2 of 2
  1. #1
    vinod.excel is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2014
    Posts
    2

    Unhappy How to get second lowest value from a field based on couple of conditions to create Summary table

    Hi All,

    I've a table with following fields
    BU, Product, Sub-Product, Product_Cost, Discount

    Lets assume there are multiple records with duplicates in (BU, Product, Sub-Product) and having different numbers at Product_Cost and Discount.

    My requirement is to pull lowest Product_cost and Max Discount values for unique record combination (BU, Product, Sub-Product)
    When lowest Product_cost is zero then need to get second lowest cost (i.e., when 1st lowest cost is zero), if all costs are zero then return zero only.

    I've written query using group by clause on all fields with Min(Product_Cost), Max(Discount) - But this results includes zero at Product_Cost which I don't want if there is a number at Product_Cost > 0



    Please guide me on how to achieve it in simple query and your response would be highly appreciated.

    Thanks.
    ~Vins

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Ask for DMIN() where the total is NOT zero. You wont need the 2nd value.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 07-19-2013, 02:05 PM
  2. Replies: 14
    Last Post: 05-22-2013, 03:33 PM
  3. Replies: 5
    Last Post: 02-05-2013, 01:18 PM
  4. Replies: 0
    Last Post: 11-17-2010, 01:21 AM
  5. Query result based upon two field conditions
    By diane802 in forum Access
    Replies: 35
    Last Post: 01-08-2010, 06:31 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums