我有这个问题:
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/Count(*),15) AS Support
FROM (SELECT *
FROM Prune AS t
WHERE t.Trans_ID IN
(SELECT t1.Trans_ID FROM (
SELECT *FROM Prune WHERE [Nama]="I1") AS t1
INNER JOIN (SELECT * FROM Prune WHERE [Nama]="I2") AS t2 ON t1.Trans_ID = t2.Trans_ID)
AND t.Nama IN ("I1","I2")) AS T1;
并且ttrans查询
SELECT Count([Trans_ID].[Trans_ID]) AS Expr1
FROM Trans_ID;
我需要更改Count (*)
:
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/Count(*),15)
进入ttrans查询。
我尝试过使用
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/ttrans.Expr1,15) AS Support
FROM (SELECT *
FROM Prune AS t
WHERE t.Trans_ID IN
(SELECT t1.Trans_ID FROM (
SELECT *FROM Prune WHERE [Nama]="I1") AS t1
INNER JOIN (SELECT * FROM Prune WHERE [Nama]="I2") AS t2 ON t1.Trans_ID = t2.Trans_ID)
AND t.Nama IN ("I1","I2")) AS T1, ttrans;
但是我得到了这样的错误:
You tried to execute a query that does not include the specified expression
'Round(sum([T1].Fuzzy_Value/ttrans.Expr1,15)' as part of an aggregate function
任何想法如何修复它?
注意:我正在尝试在事务数据库中找到所有项目的2个组合并获得这样的结果
ITEM Support
I1, I2 0.xxxxxxxxx
支持是(包含项目I1和I2 /总交易的总交易) - >请注意,我正在使用ttrans查询来获取总交易价值
note2:我正在使用MS Access 的注3:
Ttrans表将如下所示
Expr1
270200
答案 0 :(得分:0)
尝试:
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/ttrans.Expr1,15) AS Support
FROM (SELECT *
FROM Prune AS t
WHERE t.Trans_ID IN
(SELECT t1.Trans_ID FROM (
SELECT *FROM Prune WHERE [Nama]="I1") AS t1
INNER JOIN (SELECT * FROM Prune WHERE [Nama]="I2") AS t2 ON t1.Trans_ID = t2.Trans_ID)
AND t.Nama IN ("I1","I2")) AS T1, ttrans
GROUP BY "I1" & "," & "I2"
答案 1 :(得分:0)
我尝试使用
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/sum(ttrans.Expr1),15)
它很奇怪