如何更新Postgresql视图?

时间:2017-09-21 21:58:58

标签: postgresql

我在postgresql数据库中创建了一个View,如下所示(不在哪里) -

VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint();
MCvMoments moments;
double area;
MCvPoint2D64f center;
int n;

CvInvoke.FindContours(image, contours, null, RetrType.External, ChainApproxMethod.ChainApproxSimple);
n = contours.Size;

for (int i = 0; i < n; i++)
{
    area = CvInvoke.ContourArea(contours[i], false);
    moments = CvInvoke.Moments(contours[i]);
    center = moments.GravityCenter;
}

现在我想将创建视图的条件更改为(没有vt.time_started_visit&gt;'2017-09-01'         和v.campaign_id为空) -

CREATE
  VIEW visits_completed_per_day_view as select
    cast(vt.time_started_visit as date) as date
    , count(*)
  FROM
    visit v
    JOIN visit_time vt ON
      vt.visit_code = v.visit_code
  WHERE
    vt.time_started_visit > '2017-09-01'
    and v.campaign_id is null
    AND v.status in ('COMPLETED','FULLY_PAID','REFUNDED')
  GROUP BY date
  ORDER BY date

我该怎么做?我使用了以下查询,但它没有更新。

create
  VIEW visits_completed_per_day_view as select
    cast(vt.time_started_visit as date) as date
    , count(*)
  FROM
    visit v
    JOIN visit_time vt ON
      vt.visit_code = v.visit_code
  WHERE
    v.status in ('COMPLETED', 'FULLY_PAID', 'REFUNDED')
  GROUP BY date
  ORDER BY date

0 个答案:

没有答案