G
Gregg
My question is why does the first query below take about
5 seconds to run, where the second query takes about 5
minutes to run? The only difference is the first has the
criteria enter in the query and the second is using the
table shown below.
SELECT dbo_sh_sales.store, dbo_sh_sales.upc,
dbo_sh_sales.pricetype, dbo_sh_sales.quantity,
dbo_sh_time.ActualDate
FROM dbo_sh_time INNER JOIN dbo_sh_sales ON
dbo_sh_time.DateKey = dbo_sh_sales.date
WHERE (((dbo_sh_sales.store)=4) AND ((dbo_sh_sales.upc)
=1714) AND ((dbo_sh_sales.pricetype)=8 Or
(dbo_sh_sales.pricetype)=9 Or (dbo_sh_sales.pricetype)=10
Or (dbo_sh_sales.pricetype)=11) AND
((dbo_sh_time.ActualDate)<Date()));
SELECT dbo_sh_sales.store, dbo_sh_sales.upc,
dbo_sh_sales.pricetype, dbo_sh_sales.quantity,
dbo_sh_time.ActualDate
FROM DistinctStoreUPC, dbo_sh_time INNER JOIN
dbo_sh_sales ON dbo_sh_time.DateKey = dbo_sh_sales.date
WHERE (((dbo_sh_sales.store)=[DistinctStoreUPC]![STORE])
AND ((dbo_sh_sales.upc)=[DistinctStoreUPC]![UPC]) AND
((dbo_sh_sales.pricetype)=8 Or (dbo_sh_sales.pricetype)=9
Or (dbo_sh_sales.pricetype)=10 Or (dbo_sh_sales.pricetype)
=11) AND ((dbo_sh_time.ActualDate)<Date()));
DistinctStoreUPC
STORE UPC
4 1714
5 seconds to run, where the second query takes about 5
minutes to run? The only difference is the first has the
criteria enter in the query and the second is using the
table shown below.
SELECT dbo_sh_sales.store, dbo_sh_sales.upc,
dbo_sh_sales.pricetype, dbo_sh_sales.quantity,
dbo_sh_time.ActualDate
FROM dbo_sh_time INNER JOIN dbo_sh_sales ON
dbo_sh_time.DateKey = dbo_sh_sales.date
WHERE (((dbo_sh_sales.store)=4) AND ((dbo_sh_sales.upc)
=1714) AND ((dbo_sh_sales.pricetype)=8 Or
(dbo_sh_sales.pricetype)=9 Or (dbo_sh_sales.pricetype)=10
Or (dbo_sh_sales.pricetype)=11) AND
((dbo_sh_time.ActualDate)<Date()));
SELECT dbo_sh_sales.store, dbo_sh_sales.upc,
dbo_sh_sales.pricetype, dbo_sh_sales.quantity,
dbo_sh_time.ActualDate
FROM DistinctStoreUPC, dbo_sh_time INNER JOIN
dbo_sh_sales ON dbo_sh_time.DateKey = dbo_sh_sales.date
WHERE (((dbo_sh_sales.store)=[DistinctStoreUPC]![STORE])
AND ((dbo_sh_sales.upc)=[DistinctStoreUPC]![UPC]) AND
((dbo_sh_sales.pricetype)=8 Or (dbo_sh_sales.pricetype)=9
Or (dbo_sh_sales.pricetype)=10 Or (dbo_sh_sales.pricetype)
=11) AND ((dbo_sh_time.ActualDate)<Date()));
DistinctStoreUPC
STORE UPC
4 1714