SELECT Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo,Dim_Outlet.Open_Date,MAX(Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date)as fee_wholesale_date,DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) AS "Months calculation",Case WHEN Open_Date = fee_wholesale_date THEN 1 else 0 end "Added initial application",Case WHEN fee_wholesale_date < open_date THEN 1 else 0 end "Added before account opened",case when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 0 and 3 then '0 to 3'when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 3 and 6 then '3 to 6'when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 6 and 9 then '6-9' when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 9 and 12 then '9-12' when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 12 and 24 then '12-24'when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) > 24 then '24+' else 'need to check' end as [Added Clientline Indicator]--into #clientline FROM Audit_FDMS_Billing_Fees_Hist inner JOIN Dim_Outlet ON Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo = Dim_Outlet.FDMSAccountNowhere fee_sequence = '32r'and Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo ='878218871886'and DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date)<> '1361'group by Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo,Dim_Outlet.Open_Date,fee_wholesale_dateorder by "Added before account opened" desc

SELECT *
FROM
(
SELECT ROW_NUMBER() OVER (PARTITION BY Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo ORDER BY MAX(Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) DESC) AS Seq,
Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo,
Dim_Outlet.Open_Date,
MAX(Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date)as fee_wholesale_date,
DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) AS "Months calculation",
Case WHEN Open_Date = fee_wholesale_date THEN 1 else 0 end "Added initial application",
Case WHEN fee_wholesale_date < open_date THEN 1 else 0 end "Added before account opened",
case when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 0 and 3 then '0 to 3'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 3 and 6 then '3 to 6'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 6 and 9 then '6-9'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 9 and 12 then '9-12'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 12 and 24 then '12-24'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) > 24 then '24+'
else 'need to check' end as [Added Clientline Indicator]
--into #clientline
FROM Audit_FDMS_Billing_Fees_Hist
inner JOIN Dim_Outlet ON Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo = Dim_Outlet.FDMSAccountNo
where fee_sequence = '32r'
and Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo ='878218871886'
and DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date)<> '1361'
group by Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo,Dim_Outlet.Open_Date,fee_wholesale_date
)t
WHERE Seq=1
order by [Added before account opened] desc

if you want to create table on the fly use
SELECT * INTO #YourTable
FROM
(
SELECT ROW_NUMBER() OVER (PARTITION BY Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo ORDER BY MAX(Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) DESC) AS Seq,
Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo,
Dim_Outlet.Open_Date,
MAX(Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date)as fee_wholesale_date,
DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) AS "Months calculation",
Case WHEN Open_Date = fee_wholesale_date THEN 1 else 0 end "Added initial application",
Case WHEN fee_wholesale_date < open_date THEN 1 else 0 end "Added before account opened",
case when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 0 and 3 then '0 to 3'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 3 and 6 then '3 to 6'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 6 and 9 then '6-9'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 9 and 12 then '9-12'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 12 and 24 then '12-24'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) > 24 then '24+'
else 'need to check' end as [Added Clientline Indicator]
--into #clientline
FROM Audit_FDMS_Billing_Fees_Hist
inner JOIN Dim_Outlet ON Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo = Dim_Outlet.FDMSAccountNo
where fee_sequence = '32r'
and Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo ='878218871886'
and DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date)<> '1361'
group by Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo,Dim_Outlet.Open_Date,fee_wholesale_date
)t
WHERE Seq=1
order by [Added before account opened] desc
If you have precreated table you can use
INSERT INTO #YourTable
SELECT *
FROM
(
SELECT ROW_NUMBER() OVER (PARTITION BY Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo ORDER BY MAX(Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) DESC) AS Seq,
Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo,
Dim_Outlet.Open_Date,
MAX(Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date)as fee_wholesale_date,
DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) AS "Months calculation",
Case WHEN Open_Date = fee_wholesale_date THEN 1 else 0 end "Added initial application",
Case WHEN fee_wholesale_date < open_date THEN 1 else 0 end "Added before account opened",
case when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 0 and 3 then '0 to 3'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 3 and 6 then '3 to 6'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 6 and 9 then '6-9'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 9 and 12 then '9-12'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) between 12 and 24 then '12-24'
when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) > 24 then '24+'
else 'need to check' end as [Added Clientline Indicator]
--into #clientline
FROM Audit_FDMS_Billing_Fees_Hist
inner JOIN Dim_Outlet ON Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo = Dim_Outlet.FDMSAccountNo
where fee_sequence = '32r'
and Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo ='878218871886'
and DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date)<> '1361'
group by Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo,Dim_Outlet.Open_Date,fee_wholesale_date
)t
WHERE Seq=1
order by [Added before account opened] desc