I got the following two tables
TblCompany
ID, Company, Org
and
TblOrders
OrderID, CompanyID, CheckOrder
The way i want to display the record is like this
Company, Org, (Sum of orders), (Sum of CheckOrder)
My query
strSQL = "SELECT ID, Company, Org FROM tblCompany C "
strSQL=strSQL & "INNER JOIN TblOrders O "
strSQL=strSQL & "ON C.ID=O.CompanyID "
strSQL=strSQL & "WHERE C.Company LIKE '%" & Request.Form("foretag"
& "%'"
strSQL=strSQL & " ORDER BY C.ID ASC "
The problem is that it will return a new line for every order that one of the companies have done.
Can I make the query so that each company will only be displayed once and how many orders they made.
Hope for some help from you gurus
best Regards
Joakim
TblCompany
ID, Company, Org
and
TblOrders
OrderID, CompanyID, CheckOrder
The way i want to display the record is like this
Company, Org, (Sum of orders), (Sum of CheckOrder)
My query
strSQL = "SELECT ID, Company, Org FROM tblCompany C "
strSQL=strSQL & "INNER JOIN TblOrders O "
strSQL=strSQL & "ON C.ID=O.CompanyID "
strSQL=strSQL & "WHERE C.Company LIKE '%" & Request.Form("foretag"
strSQL=strSQL & " ORDER BY C.ID ASC "
The problem is that it will return a new line for every order that one of the companies have done.
Can I make the query so that each company will only be displayed once and how many orders they made.
Hope for some help from you gurus
best Regards
Joakim