문제

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.

도움이 되었습니까?

해결책

You cannot use aliases in 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");

다른 팁

If you use a subquery, I think you can use the alias:

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top