SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Below is query,
SELECT sum(isnull(Convert( float,Rec.Sell_Amt ),0))-sum(isnull(convert(float ,Pr.Rec_Amt ),0))as Amt,Pr.Level_Four_ID
FROM tbl_Receivable_Customer AS Rec
left outer join tbl_Received_Amount Pr
on Pr.Sell_ID=Rec.Sell_ID
where rec.Sell_Del is null and pr.Sell_Del is null
group by pr.Level_Four_ID
What is the error (number and message)?
We don't have access to your table definitions and data, so we cannot replicate the issue.
My guess is that the varchar column container other than numeric data.
You can find them by using
WHERE TRY_CAST([yourVarcharCol] as float) IS NULL
TRY_CAST documentation:
https://learn.microsoft.com/en-us/sql/t-sql/functions/try-cast-transact-sql?view=sql-server-ver15