• jhager (4/10/2014)


    Hi all,

    I need to find a (reasonably) simple way to get the lowest value from multiple columns along with several other columns for each row; something like this (virtually; I know it doesn't work like this):

    SELECT ProductID,ProductDesc,ProductCost,

    MIN(OrderDateTime,InventoryDateTime,SoldDateTime...)

    This will be used in a production report that accesses millions of rows, so I'm hoping for a solution that doesn't inherently kill performance.

    Thanks,

    ~ Jeff

    What would help is you posted the DDL (CREATE TABLE statement) for the table involved, some sample data (in the form of INSERT INTO statements), and the expected results based on the sample data.

    For help on this, please read the first article I reference below in my signature block regarding asking for help. It will walk you through what you need to post and how to do it. Do this and you will get better answers to your questions and tested code in return.

    Please remember that we are volunteers and we can't see what you see.