I have a qry that gets the correct output result in Access, but it is way too big for it to process. As suggested I have been able to get it put on MS SQL Server 2008, but it wasn't successful.
In summary, the subqry matches heaps of records, works out the product in groups, then the qry sums groups of these product results.
The Access qry is:
SELECT subqryProduct.TimeID, Sum(subqryProduct.ProductOfProbability) AS SumOfProductOfProbability INTO [Test sum product for sql]
FROM subqryProduct
GROUP BY subqryProduct.TimeID;
The Access sub qry is:
SELECT tblProbablility.TimeID, Exp(Sum(Log([tblProbablility].[Probablility]))) AS ProductOfProbability
FROM tblOverall INNER JOIN (tblPossible LEFT JOIN tblProbablility ON (tblPossible.WinnerID = tblProbablility.WinnerID) AND (tblPossible.MatchID = tblProbablility.MatchID)) ON tblOverall.PossibleID = tblPossible.PossibleID
GROUP BY tblProbablility.TimeID, tblOverall.OverallResult, tblPossible.PossibleID
HAVING (((tblProbablility.TimeID)=1) AND ((tblOverall.OverallResult)=2));
The sql I have tried is:
SELECT tblProbablility.TimeID, EXP(SUM(LOG(tblProbablility.Probablility))) AS Expr1, tblOverall.OverallResult, tblPossible.PossibleID
FROM tblOverall INNER JOIN
tblPossible ON tblOverall.PossibleID = tblPossible.PossibleID INNER JOIN
tblProbablility ON tblPossible.MatchID = tblProbablility.MatchID AND tblPossible.WinnerID = tblProbablility.WinnerID
GROUP BY tblProbablility.TimeID, tblOverall.OverallResult, tblPossible.PossibleID
HAVING (tblProbablility.TimeID = 1) AND (tblOverall.OverallResult = 2)
If anyone has ideas of where I have gone wrong, it would be greatly appreciated.
In summary, the subqry matches heaps of records, works out the product in groups, then the qry sums groups of these product results.
The Access qry is:
SELECT subqryProduct.TimeID, Sum(subqryProduct.ProductOfProbability) AS SumOfProductOfProbability INTO [Test sum product for sql]
FROM subqryProduct
GROUP BY subqryProduct.TimeID;
The Access sub qry is:
SELECT tblProbablility.TimeID, Exp(Sum(Log([tblProbablility].[Probablility]))) AS ProductOfProbability
FROM tblOverall INNER JOIN (tblPossible LEFT JOIN tblProbablility ON (tblPossible.WinnerID = tblProbablility.WinnerID) AND (tblPossible.MatchID = tblProbablility.MatchID)) ON tblOverall.PossibleID = tblPossible.PossibleID
GROUP BY tblProbablility.TimeID, tblOverall.OverallResult, tblPossible.PossibleID
HAVING (((tblProbablility.TimeID)=1) AND ((tblOverall.OverallResult)=2));
The sql I have tried is:
SELECT tblProbablility.TimeID, EXP(SUM(LOG(tblProbablility.Probablility))) AS Expr1, tblOverall.OverallResult, tblPossible.PossibleID
FROM tblOverall INNER JOIN
tblPossible ON tblOverall.PossibleID = tblPossible.PossibleID INNER JOIN
tblProbablility ON tblPossible.MatchID = tblProbablility.MatchID AND tblPossible.WinnerID = tblProbablility.WinnerID
GROUP BY tblProbablility.TimeID, tblOverall.OverallResult, tblPossible.PossibleID
HAVING (tblProbablility.TimeID = 1) AND (tblOverall.OverallResult = 2)
If anyone has ideas of where I have gone wrong, it would be greatly appreciated.