Query editor
The user's request to extract tiers of stakers based on their staking duration requires a different approach and additional information that is not available in the current query or table schemas. We need to know the staking start and end times for each staker to calculate their staking duration.Assuming we have a table `stakers` with columns `staker_address`, `stake_start_time`, and `stake_end_time`, we could create a query like this:```sqlSELECTstaker_address,stake_start_time,stake_end_time,TIMESTAMPDIFF(DAY, stake_start_time, stake_end_time) as staking_duration,CASEWHEN TIMESTAMPDIFF(DAY, stake_start_time, stake_end_time) BETWEEN 0 AND 30 THEN 'Tier 1'WHEN TIMESTAMPDIFF(DAY, stake_start_time, stake_end_time) BETWEEN 31 AND 60 THEN 'Tier 2'WHEN TIMESTAMPDIFF(DAY, stake_start_time, stake_end_time) BETWEEN 61 AND 90 THEN 'Tier 3'ELSE 'Tier 4'END as staker_tierFROMstakersORDER BYstaking_duration DESC;```This query calculates the staking duration for each staker and assigns them to a tier based on that duration. The tiers are defined as follows:- Tier 1: Staking duration between 0 and 30 days- Tier 2: Staking duration between 31 and 60 days- Tier 3: Staking duration between 61 and 90 days- Tier 4: Staking duration more than 90 daysPlease replace `stakers` with your actual table name and adjust the column names and tier definitions as needed.