Fix squads_view don't showing proper inserted_timestamp

This commit is contained in:
norohind 2021-10-27 20:56:20 +03:00
parent 0beb0216c3
commit 013c39426b
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1

View File

@ -39,13 +39,42 @@ inserted_timestamp datetime default current_timestamp);
create view if not exists squads_view
as
select *
from squads_states
where inserted_timestamp in (
select max(inserted_timestamp)
from squads_states
group by squad_id) and tag is not null
group by squad_id;
select squad_id,
name,
tag,
owner_name,
owner_id,
platform,
created,
created_ts,
accepting_new_members,
power_id,
power_name,
super_power_id,
super_power_name,
faction_id,
faction_name,
user_tags,
member_count,
pending_count,
full,
public_comms,
public_comms_override,
public_comms_available,
current_season_trade_score,
previous_season_trade_score,
current_season_combat_score,
previous_season_combat_score,
current_season_exploration_score,
previous_season_exploration_score,
current_season_cqc_score,
previous_season_cqc_score,
current_season_bgs_score,
previous_season_bgs_score,
current_season_powerplay_score,
previous_season_powerplay_score,
current_season_aegis_score,
previous_season_aegis_score, max(inserted_timestamp) as inserted_timestamp from squads_states group by squad_id having tag is not null;
create table if not exists news (
squad_id int,