Untitled

mail@pastecode.io avatar
unknown
sql
2 years ago
22 kB
1
Indexable
Never
select * from
(
with
    (select max(snapshot_datetime) last_snap
     from ad_space
    )
as last_snap

select 'ad_space'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from ad_space

union all

with
    (select max(snapshot_datetime) last_snap
     from ad_words_award_statistics_getuniq
    )
as last_snap

select 'ad_words_award_statistics_getuniq'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from ad_words_award_statistics_getuniq

union all

with
    (select max(snapshot_datetime) last_snap
     from adspace_campaign_coupling
    )
as last_snap

select 'adspace_campaign_coupling'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from adspace_campaign_coupling

union all

with
    (select max(snapshot_datetime) last_snap
     from advcampaign_bill
    )
as last_snap

select 'advcampaign_bill'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from advcampaign_bill

union all

with
    (select max(snapshot_datetime) last_snap
     from affiliate_link_clickthrough
    )
as last_snap

select 'affiliate_link_clickthrough'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from affiliate_link_clickthrough

union all

with
    (select max(snapshot_datetime) last_snap
     from affiliate_link_clickthrough_temp
    )
as last_snap

select 'affiliate_link_clickthrough_temp'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from affiliate_link_clickthrough_temp

union all

with
    (select max(snapshot_datetime) last_snap
     from affiliate_link_clickthrough_temp2
    )
as last_snap

select 'affiliate_link_clickthrough_temp2'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from affiliate_link_clickthrough_temp2

union all

with
    (select max(snapshot_datetime) last_snap
     from affiliate_link_open_page
    )
as last_snap

select 'affiliate_link_open_page'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from affiliate_link_open_page

union all

with
    (select max(snapshot_datetime) last_snap
     from affiliate_program
    )
as last_snap

select 'affiliate_program'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from affiliate_program

union all

with
    (select max(snapshot_datetime) last_snap
     from affiliate_program_adgoal
    )
as last_snap

select 'affiliate_program_adgoal'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from affiliate_program_adgoal

union all

with
    (select max(snapshot_datetime) last_snap
     from affiliate_program_bitrix
    )
as last_snap

select 'affiliate_program_bitrix'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from affiliate_program_bitrix

union all

with
    (select max(snapshot_datetime) last_snap
     from affiliate_programs_stage_changes_log_bitrix
    )
as last_snap

select 'affiliate_programs_stage_changes_log_bitrix'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from affiliate_programs_stage_changes_log_bitrix

union all

with
    (select max(snapshot_datetime) last_snap
     from billing_info
    )
as last_snap

select 'billing_info'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from billing_info

union all

with
    (select max(snapshot_datetime) last_snap
     from billing_info_affiliate_program
    )
as last_snap

select 'billing_info_affiliate_program'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from billing_info_affiliate_program

union all

with
    (select max(snapshot_datetime) last_snap
     from brand_auditor
    )
as last_snap

select 'brand_auditor'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from brand_auditor

union all

with
    (select max(snapshot_datetime) last_snap
     from broker_traffic
    )
as last_snap

select 'broker_traffic'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from broker_traffic

union all

with
    (select max(snapshot_datetime) last_snap
     from calls_from_sales_managers_bitrix
    )
as last_snap

select 'calls_from_sales_managers_bitrix'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from calls_from_sales_managers_bitrix

union all

with
    (select max(snapshot_datetime) last_snap
     from coupon
    )
as last_snap

select 'coupon'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from coupon

union all

with
    (select max(snapshot_datetime) last_snap
     from demand_for_withdrawal
    )
as last_snap

select 'demand_for_withdrawal'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from demand_for_withdrawal

union all

with
    (select max(snapshot_datetime) last_snap
     from deposit
    )
as last_snap

select 'deposit'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from deposit

union all

with
    (select max(snapshot_datetime) last_snap
     from direct_advert_statistics_getuniq
    )
as last_snap

select 'direct_advert_statistics_getuniq'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from direct_advert_statistics_getuniq

union all

with
    (select max(snapshot_datetime) last_snap
     from email_to_and_from_customers_bitrix
    )
as last_snap

select 'email_to_and_from_customers_bitrix'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from email_to_and_from_customers_bitrix

union all

with
    (select max(snapshot_datetime) last_snap
     from extension_analytics
    )
as last_snap

select 'extension_analytics'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from extension_analytics

union all

with
    (select max(snapshot_datetime) last_snap
     from extension_landings
    )
as last_snap

select 'extension_landings'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from extension_landings

union all

with
    (select max(snapshot_datetime) last_snap
     from fraud_tracker
    )
as last_snap

select 'fraud_tracker'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from fraud_tracker

union all

with
    (select max(snapshot_datetime) last_snap
     from google_analytics
    )
as last_snap

select 'google_analytics'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from google_analytics

union all

with
    (select max(snapshot_datetime) last_snap
     from google_analytics_business_stream
    )
as last_snap

select 'google_analytics_business_stream'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from google_analytics_business_stream

union all

with
    (select max(snapshot_datetime) last_snap
     from google_analytics_tapfiliate
    )
as last_snap

select 'google_analytics_tapfiliate'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from google_analytics_tapfiliate

union all

with
    (select max(snapshot_datetime) last_snap
     from huntflow_applicant_log
    )
as last_snap

select 'huntflow_applicant_log'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from huntflow_applicant_log

union all

with
    (select max(snapshot_datetime) last_snap
     from huntflow_vacancy
    )
as last_snap

select 'huntflow_vacancy'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from huntflow_vacancy

union all

with
    (select max(snapshot_datetime) last_snap
     from huntflow_vacancy_log
    )
as last_snap

select 'huntflow_vacancy_log'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from huntflow_vacancy_log

union all

with
    (select max(snapshot_datetime) last_snap
     from inviter_payment
    )
as last_snap

select 'inviter_payment'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from inviter_payment

union all

with
    (select max(snapshot_datetime) last_snap
     from invoices_for_advertisers
    )
as last_snap

select 'invoices_for_advertisers'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from invoices_for_advertisers

union all

with
    (select max(snapshot_datetime) last_snap
     from lost_order
    )
as last_snap

select 'lost_order'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from lost_order

union all

with
    (select max(snapshot_datetime) last_snap
     from mindbox
    )
as last_snap

select 'mindbox'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from mindbox

union all

with
    (select max(snapshot_datetime) last_snap
     from offerwall
    )
as last_snap

select 'offerwall'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from offerwall

union all

with
    (select max(snapshot_datetime) last_snap
     from order_positions
    )
as last_snap

select 'order_positions'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from order_positions

union all

with
    (select max(snapshot_datetime) last_snap
     from payment_getuniq
    )
as last_snap

select 'payment_getuniq'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from payment_getuniq

union all

with
    (select max(snapshot_datetime) last_snap
     from portals_aliexpress_orders
    )
as last_snap

select 'portals_aliexpress_orders'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from portals_aliexpress_orders

union all

with
    (select max(snapshot_datetime) last_snap
     from product_feed
    )
as last_snap

select 'product_feed'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from product_feed

union all

with
    (select max(snapshot_datetime) last_snap
     from tapfiliate_billable_period
    )
as last_snap

select 'tapfiliate_billable_period'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tapfiliate_billable_period

union all

with
    (select max(snapshot_datetime) last_snap
     from tapfiliate_commission
    )
as last_snap

select 'tapfiliate_commission'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tapfiliate_commission

union all

with
    (select max(snapshot_datetime) last_snap
     from tapfiliate_conversion
    )
as last_snap

select 'tapfiliate_conversion'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tapfiliate_conversion

union all

with
    (select max(snapshot_datetime) last_snap
     from tapfiliate_ext_log_entries
    )
as last_snap

select 'tapfiliate_ext_log_entries'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tapfiliate_ext_log_entries

union all

with
    (select max(snapshot_datetime) last_snap
     from tapfiliate_payment
    )
as last_snap

select 'tapfiliate_payment'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tapfiliate_payment

union all

with
    (select max(snapshot_datetime) last_snap
     from tapfiliate_program
    )
as last_snap

select 'tapfiliate_program'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tapfiliate_program

union all

with
    (select max(snapshot_datetime) last_snap
     from tapfiliate_program_publisher
    )
as last_snap

select 'tapfiliate_program_publisher'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tapfiliate_program_publisher

union all

with
    (select max(snapshot_datetime) last_snap
     from tapfiliate_publisher_payment
    )
as last_snap

select 'tapfiliate_publisher_payment'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tapfiliate_publisher_payment

union all

with
    (select max(snapshot_datetime) last_snap
     from tapfiliate_subscription
    )
as last_snap

select 'tapfiliate_subscription'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tapfiliate_subscription

union all

with
    (select max(snapshot_datetime) last_snap
     from target_action
    )
as last_snap

select 'target_action'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from target_action

union all

with
    (select max(snapshot_datetime) last_snap
     from target_action_adgoal
    )
as last_snap

select 'target_action_adgoal'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from target_action_adgoal

union all

with
    (select max(snapshot_datetime) last_snap
     from target_action_temp
    )
as last_snap

select 'target_action_temp'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from target_action_temp

union all

with
    (select max(snapshot_datetime) last_snap
     from target_mail_statistics_getuniq
    )
as last_snap

select 'target_mail_statistics_getuniq'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from target_mail_statistics_getuniq

union all

with
    (select max(snapshot_datetime) last_snap
     from ticket_system
    )
as last_snap

select 'ticket_system'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from ticket_system

union all

with
    (select max(snapshot_datetime) last_snap
     from tracking_request
    )
as last_snap

select 'tracking_request'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tracking_request

union all

with
    (select max(snapshot_datetime) last_snap
     from tracking_request_temp
    )
as last_snap

select 'tracking_request_temp'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tracking_request_temp

union all

with
    (select max(snapshot_datetime) last_snap
     from tracking_request_temp_2
    )
as last_snap

select 'tracking_request_temp_2'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tracking_request_temp_2

union all

with
    (select max(snapshot_datetime) last_snap
     from tracking_request_temp_3
    )
as last_snap

select 'tracking_request_temp_3'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from tracking_request_temp_3

union all

with
    (select max(snapshot_datetime) last_snap
     from transfer_money_getuniq
    )
as last_snap

select 'transfer_money_getuniq'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from transfer_money_getuniq

union all

with
    (select max(snapshot_datetime) last_snap
     from user_balance_log
    )
as last_snap

select 'user_balance_log'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from user_balance_log

union all

with
    (select max(snapshot_datetime) last_snap
     from user_referral
    )
as last_snap

select 'user_referral'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from user_referral

union all

with
    (select max(snapshot_datetime) last_snap
     from vk_ads_market_monthly_statistics_getuniq
    )
as last_snap

select 'vk_ads_market_monthly_statistics_getuniq'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from vk_ads_market_monthly_statistics_getuniq

union all

with
    (select max(snapshot_datetime) last_snap
     from web_notification_message
    )
as last_snap

select 'web_notification_message'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from web_notification_message

union all

with
    (select max(snapshot_datetime) last_snap
     from webmaster
    )
as last_snap

select 'webmaster'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from webmaster

union all

with
    (select max(snapshot_datetime) last_snap
     from webmaster_balance
    )
as last_snap

select 'webmaster_balance'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from webmaster_balance

union all

with
    (select max(snapshot_datetime) last_snap
     from yandex_direct_award_statistics_getuniq
    )
as last_snap

select 'yandex_direct_award_statistics_getuniq'  as table,
       count() as rows,
       countIf(toDate(snapshot_datetime)=toDate(last_snap)) as last_day_rows,
       last_snap,
       toTypeName(last_snap) AS x
from yandex_direct_award_statistics_getuniq
    )
order by last_snap desc, table;