MySQL: Script to Create a Calendar

Posted on

Copied and tweaked from Github DROP TABLE IF EXISTS time_dimension; CREATE TABLE time_dimension ( id INTEGER PRIMARY KEY, — year*10000+month*100+day db_date DATE NOT NULL, year INTEGER NOT NULL, month INTEGER NOT NULL, — 1 to 12 day INTEGER NOT NULL, — 1 to 31 quarter INTEGER NOT NULL, — 1 to 4 week INTEGER […]


Mautic: Helpful Queries to Audit your System

Posted on

  To  check how many emails are triggered and sent for your campaigns Today. SELECT,,, leads.custom_mkt_drip, campaign_lead_event_log.* FROM campaign_lead_event_log left join leads on campaign_lead_event_log.lead_id = left join email_stats ON = email_stats.email_address WHERE DATE(date_triggered) = DATE(NOW()) AND campaign_lead_event_log.is_scheduled = 0 AND = “email” AND metadata NOT LIKE “%failed%” ORDER BY […]


SugarCRM: Copy Saved Search

Posted on

This is an example query of how to duplicate a record on a MySQL DB. The only challenge here is to autogenerate de ID (this has to be done specifically based on your DB structure). SELECT id, name, search_module, deleted, date_entered, date_modified, assigned_user_id, contents, description FROM crm_em.saved_search WHERE search_module = “Leads” AND name = “Employees_Updated”; […]