1
SELECT Bot.BetType, 
   Sum(Bot.Result) AS Won, 
   IIf([Bot]![Market Name] Like "*Place*", "Place", "Win") AS Type
FROM Bot
GROUP BY Bot.BetType, Type;

Getting error:

You tried to execute a query that does not include the specified expression If([Bot]![Market Name] Like "*Place*", "Place", "Win") as part of an aggregate function.

I did not find a result from google. If you have any questions, feel free to ask.

4

2 回答 2

3

您不能在 GROUP BY 中使用别名:

SELECT Bot.BetType, 
   Sum(Bot.Result) AS Won, 
   IIf([Bot]![Market Name] Like "*Place*", "Place", "Win") AS Type
FROM Bot
GROUP BY Bot.BetType, IIf([Bot]![Market Name] Like "*Place*", "Place", "Win");
于 2013-01-13T15:36:59.463 回答
1

如果您使用子查询,我认为您可以使用别名:

SELECT B.BetType, 
       Sum(B.Result) AS Won,
       type
from (select b.*, IIf([Bot]![Market Name] Like "*Place*", "Place", "Win") AS Type
      FROM Bot b
     ) b
GROUP BY b.BetType, Type;
于 2013-01-13T16:37:48.670 回答