Okay this is what I'm trying to do, the code is posted at the bottom. I have a report that I'm making for our customers. In the table I have fields of ALTACCTNBR, AMPORDERFK, SLUGLINE, BASEAMOUNT, RUNDATE, REALMILLIMETERS among other fields.
What I need to do is count the number of AMPORDERFK that are the same for each ALTACCTNBR, there are multiple, which is returned in insertion count crosstab query.
I also need a mathematical query that converts the millimeters field into a field with inches, I also have a mathematical query that then applies the inches to a rate, but I left this out because if you can help with the next step, I should be able to figure the rest on my own.
The problem is that I need to be able to access the information REALINCHES and Total of AMPORDERFK in the same query and also access other fields from the original table as I have more calculations to do.
The original table has linked tables to another database that is updating moderately often, so I don't think I can just export the data into another table, because I will lose the data. Is there any way of joining the two queries to make one, The only info that I need from the crosstab is the Total of AMPORDERFK as that is the number of times I need to apply the rate.
Code for insertion count crosstab query:
Code:
TRANSFORM Count([Folio Sepation by rate].AMPORDERFK) AS CountOfAMPORDERFK
SELECT [Folio Sepation by rate].ALTACCTNBR, [Folio Sepation by rate].SLUGLINE, [Folio Sepation by rate].BASEAMOUNT, Count([Folio Sepation by rate].AMPORDERFK) AS [Total Of AMPORDERFK]
FROM [Folio Sepation by rate]
GROUP BY [Folio Sepation by rate].ALTACCTNBR, [Folio Sepation by rate].SLUGLINE, [Folio Sepation by rate].BASEAMOUNT
PIVOT Format([RUNDATE],"Short Date");
Code for Math procedure query:
Code:
SELECT REALMILLIMETERS, AMPORDERFK, Round((REALMILLIMETERS*(1/25.4))*REALCOLS,2) AS REALINCHES
FROM [Folio Sepation by rate];