W
WB
I am using Access 2000 and trying to execute the following query.
SELECT x0.*
FROM qryRetainedBase AS x0
WHERE (((x0.TransactionId) In (SELECT TOP 2 x1.TransactionId
FROM qryRetainedBase x1
WHERE x1.CustomerId = x0.CustomerId)));
qryRetainedBase:
SELECT tblTransaction.CustomerId, tblTransaction.TransactionId,
tblTransaction.StylistId
FROM (tblTransaction INNER JOIN tblTransactionDetail ON
tblTransaction.TransactionId = tblTransactionDetail.TransactionId) INNER
JOIN tblInventory ON tblTransactionDetail.InventoryId =
tblInventory.InventoryId
WHERE (((tblTransaction.CustomerId)<>66 And (tblTransaction.CustomerId)<>70
And (tblTransaction.CustomerId)<>71 And (tblTransaction.CustomerId)<>6240)
AND ((tblTransaction.TransactionDate)>#7/1/2004#) AND
((tblInventory.Retail)=0))
ORDER BY tblTransaction.CustomerId, tblTransaction.TransactionId DESC;
When I execute the qryRetainedBase I get results; however, when I execute
the first query it just hangs and I have to kill the process. When I run
the same SQL on SQL Server 2000 there is no problem. Is there a reason
Access can't handle this type of nested query?
WB
SELECT x0.*
FROM qryRetainedBase AS x0
WHERE (((x0.TransactionId) In (SELECT TOP 2 x1.TransactionId
FROM qryRetainedBase x1
WHERE x1.CustomerId = x0.CustomerId)));
qryRetainedBase:
SELECT tblTransaction.CustomerId, tblTransaction.TransactionId,
tblTransaction.StylistId
FROM (tblTransaction INNER JOIN tblTransactionDetail ON
tblTransaction.TransactionId = tblTransactionDetail.TransactionId) INNER
JOIN tblInventory ON tblTransactionDetail.InventoryId =
tblInventory.InventoryId
WHERE (((tblTransaction.CustomerId)<>66 And (tblTransaction.CustomerId)<>70
And (tblTransaction.CustomerId)<>71 And (tblTransaction.CustomerId)<>6240)
AND ((tblTransaction.TransactionDate)>#7/1/2004#) AND
((tblInventory.Retail)=0))
ORDER BY tblTransaction.CustomerId, tblTransaction.TransactionId DESC;
When I execute the qryRetainedBase I get results; however, when I execute
the first query it just hangs and I have to kill the process. When I run
the same SQL on SQL Server 2000 there is no problem. Is there a reason
Access can't handle this type of nested query?
WB