troubleshooting Question

SQL 2005, Find Min Value within Same Row, but not 0

Avatar of Daniel_P67
Daniel_P67 asked on
Microsoft SQL Server 2005
4 Comments1 Solution476 ViewsLast Modified:
Have a SQL 2005 Table that i need to find the Min value out of three Columns but if the Value is a 0 the next highest needs to be selected. Would like to place this Min value in a new column. Like below.

What i have been able to find online is that Min will only work with across one column but i need it to work across three columns within one row. Is there a function or something like lowest, that may work?

Thanks
Col1     1QTY       2QTY       3QTY

A         0        3         7
B         10      4        200 
C          0       0        9
D         1        2        5

TO

Col1    1QTY      2QTY      3QTY      MinValue

A         0        3         7          3
B         10      4        200        4
C          0       0        9           9
D         1        2        5           1


 
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros