I have 2 tables
1st INVHD
2nd INVDT

In INVHD I have following fields
InvNo, InvDate,CustCd, CustName, TotalDisc (Discount on total Invoice), GrandTotal

In INVDT I have following fields
InvNo, RowNo,ItemCode, Qty, Rate, BaseVal, etc….

Now I need a query to be generated for
The customer
CustCd, CustName, Sum(totalDisc), Sum(GrandTotal) , sum(BaseVal)

For given period primary key is InvNo

Hi pitulobo and welcome to DaniWeb :),

This can be achieved with a simple join in the two tables on the key InvNo. Have a try at it and post back if you are struggling with your code and we will see where you have gone wrong.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.