Luis Cazares (6/28/2013)
Welcome to this forum,I really hope that we can help you, but there's something that I can't understand. You say: "The flag indicator will tag with 'Y' if 1 unit >= 50"
Do you mean that only when there's a single unit? or when any unit is >= 50?
To get better help, you should give us DDL and sample data in a consumable format. Since you're new to this forum and SQL, I'll do it for you, but I recommend you to read the article linked in my signature.
CREATE TABLE #Test (
Unit_ID int,
Value int)
INSERT #Test VALUES
(1, 20),
(1, 30),
(1, 20),
(1, 30),
(1, 10),
(2, 51),
(3, 50),
(4, 20),
(4, 30),
(4, 10),
(4, 5),
(4, 50),
(5, 5),
(5, 50),
(6, 5),
(6, 3),
(6, 50),
(7, 35),
(7, 4)
SELECT *
FROM #Test
DROP TABLE #Test
Hi Luis , only display "Y" flag if there is a single unit_id with value >= 50 (without sum up other value)