Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Query from 4 Tables

Author  Topic 

ravininave
Posting Yak Master

111 Posts

Posted - 2012-09-06 : 09:30:10
I've Four Tables

Registration
Layoutmast
AgentMast
Receipts

Here is my Query

Select Registration.Name,
LayoutMast.ProjName ,
AgentMast.AgentName
from AgentMast INNER JOIN Registration On AgentMast.AgentCode = Registration.AgentCode
INNER JOIN LayoutMast on Registration.LCode = LayoutMast .CodeNo
where Registration.UserName = @Username and Registration.UserPass = @UserPass;

It's working fine up to here.
Now I've to modify this query little bit
With this query:
1] I've to fetch sum(Amount) for the Registration.CodeNo (Registration.CodeNo = Receipt.CodeNo)
2] I've to Fetch Last Payment Date & Amount from Receipt of the Customer

How could I modify the query further. I don't know.


VB6/ASP.NET
------------------------
http://www.nehasoftec.com
   

- Advertisement -