TAC MQLplus

view name = 'tac_mqlPlus'

[NEW] Query

 SELECT date_trunc('day'::text, "mqlPlus_date")::date AS date,
    to_char(date_trunc('month'::text, "mqlPlus_date")::date::timestamp with time zone, 'YYYY Mon'::text) AS month,
    (to_char(date_trunc('week'::text, "mqlPlus_date")::date::timestamp with time zone, 'DD Mon'::text) || ' - '::text) || to_char(date_trunc('week'::text, "mqlPlus_date")::date + '6 days'::interval, 'DD Mon'::text) AS week,
    branch,
    contact_owner,
    assigned_pic,
    last_created_by,
    source,
    sremarks,
    medium,
    mremarks,
    count("mqlPlus_date") AS mqlplus
   FROM combined
  WHERE hide IS NULL OR hide = false
  GROUP BY (date_trunc('week'::text, "mqlPlus_date")::date), (date_trunc('day'::text, "mqlPlus_date")::date), (to_char(date_trunc('month'::text, "mqlPlus_date")::date::timestamp with time zone, 'YYYY Mon'::text)), ((to_char(date_trunc('week'::text, "mqlPlus_date")::date::timestamp with time zone, 'DD Mon'::text) || ' - '::text) || to_char(date_trunc('week'::text, "mqlPlus_date")::date + '6 days'::interval, 'DD Mon'::text)), branch, contact_owner, assigned_pic, last_created_by, source, sremarks, medium, mremarks
  ORDER BY (date_trunc('day'::text, "mqlPlus_date")::date);

Last updated