troubleshooting Question

MS sql query to get a closer number

Avatar of HemlockPrinters
HemlockPrinters asked on
Microsoft SQL Server 2005
3 Comments1 Solution459 ViewsLast Modified:
I need a query to get a quantity number.
the  table has 6 quantity fields
Qty    Qty1   Qty2  Qty3  Qty4  Qty5

I need to find the quantity number among Qty1 to Qty5 which is closer to QTY and add another column for CloserQty to the table.

For example:
Qty    Qty1   Qty2  Qty3  Qty4  Qty5  closerQty
100    500    400    50      962  110     110

Database Consultant
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
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 3 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