Skip to content

Instantly share code, notes, and snippets.

@alpha1
Last active June 12, 2018 02:51
Show Gist options
  • Save alpha1/33f923cc53f2fb7f8baa416fc139586b to your computer and use it in GitHub Desktop.
Save alpha1/33f923cc53f2fb7f8baa416fc139586b to your computer and use it in GitHub Desktop.
Revive Ad Server raw SQL
#Show all active campaigns
SELECT * FROM `rv_campaigns` WHERE `activate_time` <= now() and expire_time >= now()
#show all past campaigns
SELECT * FROM `rv_campaigns` WHERE `activate_time` <= now() and expire_time <= now()
#show all upcoming campaigns
SELECT * FROM `rv_campaigns` WHERE `activate_time` >= now()
#show campaigns with clients (advertiser) information
SELECT * FROM `rv_campaigns`
LEFT JOIN rv_clients on rv_campaigns.clientid=rv_clients.clientid
#shows banners with campaigns and client (advertiser) information
SELECT * FROM `rv_banners`
LEFT JOIN rv_campaigns on rv_banners.campaignid=rv_campaigns.campaignid
LEFT JOIN rv_clients on rv_campaigns.clientid=rv_clients.clientid
#shows statistics with banners, campaigns and clients (Advertisers)
SELECT * FROM `rv_data_summary_ad_hourly`
LEFT JOIN rv_banners ON rv_data_summary_ad_hourly.ad_id=rv_banners.bannerid
LEFT JOIN rv_campaigns on rv_banners.campaignid=rv_campaigns.campaignid
LEFT JOIN rv_clients on rv_campaigns.clientid=rv_clients.clientid
#shows statistics with zones banners, campaigns and clients (Advertisers)
SELECT * FROM `rv_data_summary_ad_hourly`
LEFT JOIN rv_zones ON rv_data_summary_ad_hourly.zone_id=rv_zones.zoneid
LEFT JOIN rv_banners ON rv_data_summary_ad_hourly.ad_id=rv_banners.bannerid
LEFT JOIN rv_campaigns on rv_banners.campaignid=rv_campaigns.campaignid
LEFT JOIN rv_clients on rv_campaigns.clientid=rv_clients.clientid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment