Hi @Bone_12 ,
Welcome to the microsoft tsql Q&A forum!
Your question is related to tsql, so my colleague helped you add the tsql tag.
Sorry, your description is not clear enough for me. I don't know what the specific problem you encountered is.Generally speaking, the over function is used together with aggregate functions, ranking functions, etc. Cannot be used alone in the CASE WHEN statement.
We recommend that you provide the relevant tables and data (CREATE and INSERT statements), as well as the results you expect.
Perhaps the following is what you want:
case when Co_table = '2' and Co_field = '1'
then max(Co_Numeric) over(partition by Cust_id) end as 'Rec_Change'
For the OVER function, please refer to:
SELECT - OVER Clause (Transact-SQL)
If you have any question, please feel free to let me know.
Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.