Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Min function in rows

Status
Not open for further replies.
May 21, 2003
64
US
I have info set up the follwing way for each record:

cust #, item #, value1, value2, value3... value 9

I would like to return cuts #, Item # and the lowest of the 9 values. Is there a way to do this with the min function? Thanks.
 
Create 9 selects and union together, then use the results. approximate and not tested.

Select cust #, item #, min(value1)
From
(select cust #, item #, value1 from yourtable
union
select cust #, item #, value2 from yourtable
union
select cust #, item #, value3 from yourtable
etc....
select cust #, item #, value9 from yourtable) as tab
Group by cust #, item #
 
SEarch these fora for the function basMinVal. It is designed for this issue.




MichaelRed
mlred@verizon.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top