如何减去特定条件为真的产品数量

时间:2017-05-02 06:49:00

标签: sql snowflake-datawarehouse

    Date     Visitorid  Visitnumber  Condition A 
    1/1/2017    123        2             OF
    1/1/2017    123        3             OF
    1/1/2017    123        30            ABC
    1/2/2017    123        34            OP
    1/1/2017    124        1             OF
    1/2/2017    124        2             OP

我希望minus visitorId访问过的访问号码' OF'首先访问了OP' (但它应该在不同的日期)并且还想将上述结果分组为

 Count of visitor_ids where minus (of visit number is 1)
 Count of visitor_ids where minus (of visit number is 2)

等等

0 个答案:

没有答案