I have this query:
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;
And ttrans query
SELECT Count([Trans_ID].[Trans_ID]) AS Expr1
FROM Trans_ID;
I need to change Count (*)
from :
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/Count(*),15)
into ttrans query.
I've tried using
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/ttrans.Expr1,15) AS Support
FROM (SELECT *
FROM P开发者_运维技巧rune 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;
But I got error like this :
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
any idea how to fix it?
Note : I'm trying to find 2 combination of all item in transaction database and get a result like this
ITEM Support
I1, I2 0.xxxxxxxxx
where support is (total transaction containing item I1 and I2 / total transaction) -> note that I'm using ttrans query to get total transaction value
note2: I'm using MS Access note3:
Ttrans table will look like this
Expr1
270200
Try:
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"
somehow i find the answer :
i tried using
SELECT "I1" & "," & "I2" AS Item_set, Round(Sum([T1].Fuzzy_Value)/sum(ttrans.Expr1),15)
it worked wonder
精彩评论