TAC Inbound

view name = 'tac_inbound'

[NEW] Query

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

Last updated