[![enter image description here][1]][1] SELECT
POLICY_NO,
FORMATTED_POLICY_NUMBER,
POLICY_EFFECTIVE_DATE AS Effectivedt,
POLICY_REWRITTEN_FROM Frompolicy,
POLICY_EXPIRATION_DATE FromExpirationDate
FROM
TableName
WHERE
Load_End_Date = '99991231'
The policy num and formatted policy num needs to be joined as one column and must get data based on max (renewal_no).
Let's say the max renewal num is 9 so I must get a 9th renewed policy num as the current policy number. So the both policy_no and formatted_policy_number column must be a single column as Current policy number based on max renewal number.