I'm sure there's a simple solution here, and I've attempted to use a CASE statement with a concatenation, but it's not quite giving me what I need. Very simply, I am trying to write a query that will select the MIN value that is >= 3, and going forward, only select values that are >= 3 + 12 and so on (3, 15, 27, etc.) Here's my query:
SELECT min(appearance_count) AC
,customer
FROM #final
WHERE gm IS NOT NULL
GROUP BY customer
Sample result set:
I have a test row that I can use to validate that my query is working as expected, but as stated, I can't pull it in addition to the results above.
Clarification: The AC column will have numbers that start with 1 and continue to grow with each month (+1 AC for each month that passes).
Sample Data:
AC customer
4 BELL TEXTRON INC
... BELL TEXTRON INC
16 BELL TEXTRON INC
I would need to pull both the 4 and the 16 and none of the values in between, for this example.