((
create view v_test_bets_stats as
select skill.user_id,
skill.game_id,
sum(skill.bonus_count_bet_50_100) bonus_count_bet_50_100,
sum(skill.bonus_count_bet_above_100) bonus_count_bet_above_100,
sum(skill.cash_count_bet_50_100) cash_count_bet_50_100,
sum(skill.cash_count_bet_above_100) cash_count_bet_above_100,
sum(skill.bonus_count) bonus_count,
sum(skill.cash_count) cash_count
from (
select 'Last 7 Game Days' type,
ts.user_id,
ts.game_id,
case
when ts.is_cashbet = 0 and ts.cost >= 5000 and ts.cost < 10000 then 1
else 0 end bonus_count_bet_50_100,
case when ts.is_cashbet = 0 and ts.cost >= 10000 then 1 else 0 end bonus_count_bet_above_100,
case
when ts.is_cashbet = 1 and ts.cost >= 5000 and ts.cost < 10000 then 1
else 0 end cash_count_bet_50_100,
case when ts.is_cashbet = 1 and ts.cost >= 10000 then 1 else 0 end cash_count_bet_above_100,
case when ts.is_cashbet = 0 then 1 else 0 end bonus_count,
case when ts.is_cashbet = 1 then 1 else 0 end cash_count
from tickets_sold ts
where today() - ts.date + 1/*include current day*/ <= 7
) skill
group by skill.user_id, skill.game_id
не подскажите?
А какую ошибку пишет?
Code: 47, e.displayText() = DB::Exception: Missing columns: 'ts.game_id' 'ts.user_id' 'ts.date' 'ts.cost' 'ts.is_cashbet' while processing query и дальше сама view
Попробуйте во вложеном селекте, например для ts.game_id, добавить алиас с тем же именем : ... select 'Last 7 Game Days' type, ts.user_id, ts.game_id AS game_id, ...
неа (( везде добавил таже ошибка
во вью сломаны алисы from tickets_sold ts from tickets_sold вместо ts.поле , надо писать tickets_sold.поле или вообще ничего не писать
Огромное спасибо!
Обсуждают сегодня