Query question
From: Gregg (anonymous_at_discussions.microsoft.com)
Date: 06/09/04
- Next message: Ted Allen: "Re: Break names into separate fields"
- Previous message: John Spencer (MVP): "Re: qry to exlude records with same field value"
- Next in thread: Van T. Dinh: "Query question"
- Reply: Van T. Dinh: "Query question"
- Reply: John Spencer (MVP): "Re: Query question"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 9 Jun 2004 15:38:58 -0700
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
- Next message: Ted Allen: "Re: Break names into separate fields"
- Previous message: John Spencer (MVP): "Re: qry to exlude records with same field value"
- Next in thread: Van T. Dinh: "Query question"
- Reply: Van T. Dinh: "Query question"
- Reply: John Spencer (MVP): "Re: Query question"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|