ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Calculate remaining dues for each student in SQL Server<p>Hi <a class="username" rel="smile"> smile</a>,</p> <p>Please check the below query.</p> <p><span style="text-decoration: underline;"><strong>SQL</strong></span></p> <pre class="brush: sql">SELECT fg.AdmissionNo,RemBal + SUM(Head+ExamFees) &#39;Total&#39;,ISNULL((SELECT TOP 1 Paid FROM tblFeesCollection WHERE FeesMonth=&#39;8-Aug&#39; AND fg.AdmissionNo=&#39;R-000003&#39;),0) &#39;Paid&#39; ,(RemBal + SUM(Head+ExamFees)) - ISNULL ((SELECT TOP 1 Paid FROM tblFeesCollection WHERE FeesMonth=&#39;8-Aug&#39; AND fg.AdmissionNo=&#39;R-000003&#39;),0) as [RemBal] FROM tblFeesGenerate as fg INNER JOIN tblFeesCollection as fc ON fg.AdmissionNo=fc.AdmissionNo WHERE fc.FeesMonth=&#39;8-Aug&#39; AND fg.AdmissionNo=&#39;R-000003&#39; GROUP BY fg.AdmissionNo,RemBal</pre>https://www.aspforums.net:443/Threads/165478/Calculate-remaining-dues-for-each-student-in-SQL-Server/https://www.aspforums.net:443/Threads/165478/Calculate-remaining-dues-for-each-student-in-SQL-Server/Wed, 03 Oct 2018 06:42:01 GMT