dwain.c (9/13/2012)
ChrisM@Work (9/13/2012)
SELECT
Id, A, B, C,
MinVal
FROM #MinAmt
CROSS APPLY (
SELECT MIN(a)
FROM (VALUES (A),(B),(C) ) v (a)
WHERE a > 0
) x (MinVal)
๐
And the referee throws down a red penalty flag!
This is the SQL 2005 forum!
Challenged! texpic always posts in the 2K8 forum!
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden