I'm trying to pull this data in my first inner join trying to pull the rmsbalance based on the latest date/time combination but not having any luck with my syntax because sql is throwing errors due to my syntax below and I can't figure how how to do the check on the date and time combo:
SELECT rf.RMSTRANCDE,
rm.rmsacctnum,
SUM(rf.rmstranamt) AS [Sum Tran Amt],
rf10.rmsbalance
FROM RMASTER rm
INNER JOIN <-- Problem starts in this inner join
(
SELECT RMSFILENUM,
rmsbalance
FROM RFINANL a
where rmstrandte + rmstrantim = (select max(rmstrandte) + max(rmstrantm) from RFINANL)
) AS rf10 ON rf10.RMSFILENUM = rm.RMSFILENUM
INNER JOIN
(
SELECT RMSFILENUM,
RMSTRANCDE,
SUM(rmstranamt) AS rmstranamt
FROM RFINANL
GROUP BY RMSFILENUM, RMSTRANCDE
) AS rf ON rf.RMSFILENUM = rm.RMSFILENUM
GROUP BY rm.rmsacctnum, rf.RMSTRANCDE, rf10.rmsbalance
HAVING rf10.rmsbalance <> SUM(rf.rmstranamt)
AND rf10.rmsbalance <> 0.00
What is the error message? Syntax of the SELECT statement seems fine.|||thanks, but I actually figured it out on my own
sql