G
Guest
The database contains comparetive data on competition for a certain product
range.
t_main table contains my product range (codes, parameters, prices)
competition table contains similar data on somebody else competitive
products
analog table indicates which compatitive products are analogues to which of
my products.(many-to-many relationship)
I understand you need only those fields which are involved in the query
SELECT
Avg(competition.price_rub*Sqr(t_main.per_pack/competition.quantity))/[rub]
AS Expr1
FROM competition, analog, t_main
WHERE (((analog.af_product)=[] AND (analog.af_product)=[t_main].[pr_code])
AND ((analog.direct_analog)=Yes) AND
(([analogs].[competitor_id])=[competition].[id]));
These are:
competition
id - Autonumber Long Integer
price_rub - currency, fixed with dot as decimal point eg. 100.00
quantity - Number Long integer eg.400
neither are key or part of the key
analog
competitor_id - Number Long integer eg. 75
af_product -text eg. AAA000
direct_analog - yes/no
the first two make a composite key
t_main
pr_code - text eg. AAA000 (key field)
per_pack - Number Long integer eg. 300
Parameter rub (the exchange rate) is stored in an ASP Application scope
variable and returns type 5 (double precision floating point number)
Parameter [] is taken from another recordset containg a value from
t_main.pr_code, i.e. something like AAA000
range.
t_main table contains my product range (codes, parameters, prices)
competition table contains similar data on somebody else competitive
products
analog table indicates which compatitive products are analogues to which of
my products.(many-to-many relationship)
I understand you need only those fields which are involved in the query
SELECT
Avg(competition.price_rub*Sqr(t_main.per_pack/competition.quantity))/[rub]
AS Expr1
FROM competition, analog, t_main
WHERE (((analog.af_product)=[] AND (analog.af_product)=[t_main].[pr_code])
AND ((analog.direct_analog)=Yes) AND
(([analogs].[competitor_id])=[competition].[id]));
These are:
competition
id - Autonumber Long Integer
price_rub - currency, fixed with dot as decimal point eg. 100.00
quantity - Number Long integer eg.400
neither are key or part of the key
analog
competitor_id - Number Long integer eg. 75
af_product -text eg. AAA000
direct_analog - yes/no
the first two make a composite key
t_main
pr_code - text eg. AAA000 (key field)
per_pack - Number Long integer eg. 300
Parameter rub (the exchange rate) is stored in an ASP Application scope
variable and returns type 5 (double precision floating point number)
Parameter [] is taken from another recordset containg a value from
t_main.pr_code, i.e. something like AAA000
Bob Barrows said:aa said:Is this a typo? What is meant by []?
No, this is how I do parameterized queries in Access.
[] means a parameter to be enteres during runtime.
Is this wrong?
Then I hope this is the reason for the error. How it should be?
I always give my parameters a name.It makes the queries a little more
self-documenting. I guess it can work, but I would never use [] as a
parameter.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.