How can I count unique orders from unique locations in teradata in relative time intervals?












0














There is a hypothetical database that records millions of customer transactions per day.

Aim is to identify unique patterns in the transactions i.e. count unique orders in relative time frames per second, minute, per hour, etc. as well as unique orders per locations.

There are a number of other variables but I have provided this extract to keep it simple.



So, basically, I would like to count in relative time frames rather than the 'cardinal' time extract. I'm not sure how to do that. I have searched the different forums but can't work out how to do this in Teradata sql.



I would really appreciate any help with this!



Thanks in advance



Example dataset






+----------+---------------+----------------------+------+
| Customer | Product | DateTime | City |
+----------+---------------+----------------------+------+
| 1 | Fortnite | 2018-10-29 11:18:54 | AL |
| 1 | PUBG | 2018-10-29 11:19:42 | AK |
| 1 | Overwatch | 2018-10-29 11:19:42 | AZ |
| 1 | DoTA2 | 2018-10-29 11:19:42 | AR |
| 1 | CS:GO | 2018-10-29 11:19:43 | CA |
| 1 | Rocket league | 2018-10-29 11:19:44 | CO |
| 1 | PUBG | 2018-10-29 11:19:46 | AR |
| 1 | Borderlands2 | 2018-10-29 11:19:46 | CT |
| 1 | CS:GO | 2018-10-29 11:19:47 | CA |
| 1 | Borderlands2 | 2018-10-29 11:19:47. | CT |
| 1 | Path of exile | 2018-10-29 11:19:51 | CT |
| 1 | Path of exile | 2018-10-29 11:19:53 | CT |
| 1 | Hearthstone | 2018-10-29 11:19:56 | CT |
| 1 | Hearthstone | 2018-10-29 11:19:57 | DE |
| 1 | Wonderputt | 2018-10-29 11:19:57 | CT |
+----------+---------------+----------------------+------+





I used this code and got the answer below



SELECT  Customer, Product, DateTime, City

,COUNT(*) OVER (PARTITION BY Customer, DateTime + INTERVAL '1' SECOND) AS #ofOrders_per_1sec


,DENSE_RANK() OVER (PARTITION BY Customer,
EXTRACT(DAY FROM DateTime),
EXTRACT(HOUR FROM DateTime),
EXTRACT(MINUTE FROM DateTime),
EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND)
ORDER BY Product ASC)
+ DENSE_RANK() OVER (PARTITION BY Customer,
EXTRACT(DAY FROM DateTime),
EXTRACT(HOUR FROM DateTime),
EXTRACT(MINUTE FROM DateTime),
EXTRACT(MINUTE FROM DateTime),
EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND) ORDER BY Product DESC) - 1
AS Unique_Products_per_1sec

,DENSE_RANK() OVER (PARTITION BY Customer,
EXTRACT(DAY FROM DateTime),
EXTRACT(HOUR FROM DateTime),
EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE)
ORDER BY Product ASC)
+ DENSE_RANK() OVER (PARTITION BY Customer,
EXTRACT(DAY FROM DateTime),
EXTRACT(HOUR FROM DateTime),
EXTRACT(MINUTE FROM DateTime),
EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE) ORDER BY Product DESC) - 1
AS Unique_Products_per_1min

,DENSE_RANK() OVER (PARTITION BY Customer,
EXTRACT(DAY FROM DateTime),
EXTRACT(HOUR FROM DateTime),
EXTRACT(MINUTE FROM DateTime),
EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND)
ORDER BY City ASC)
+ DENSE_RANK() OVER (PARTITION BY Customer,
EXTRACT(DAY FROM DateTime),
EXTRACT(HOUR FROM DateTime),
EXTRACT(MINUTE FROM DateTime),
EXTRACT(MINUTE FROM DateTime),
EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND) ORDER BY City DESC) - 1
AS Unique_City_per_1sec

,DENSE_RANK() OVER (PARTITION BY Customer,
EXTRACT(DAY FROM DateTime),
EXTRACT(HOUR FROM DateTime),
EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE)
ORDER BY City ASC)
+ DENSE_RANK() OVER (PARTITION BY Customer,
EXTRACT(DAY FROM DateTime),
EXTRACT(HOUR FROM DateTime),
EXTRACT(MINUTE FROM DateTime),
EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE) ORDER BY City DESC) - 1
AS Unique_City_per_1min
FROM Dataset


Result from the code above
Current result output



However, I would expect the results below:
Ideally, to count the transactions in relative terms instead of using 'cardinal' or absolute time xtract from the datetime field.



Desired result output
Desired result output










share|improve this question





























    0














    There is a hypothetical database that records millions of customer transactions per day.

    Aim is to identify unique patterns in the transactions i.e. count unique orders in relative time frames per second, minute, per hour, etc. as well as unique orders per locations.

    There are a number of other variables but I have provided this extract to keep it simple.



    So, basically, I would like to count in relative time frames rather than the 'cardinal' time extract. I'm not sure how to do that. I have searched the different forums but can't work out how to do this in Teradata sql.



    I would really appreciate any help with this!



    Thanks in advance



    Example dataset






    +----------+---------------+----------------------+------+
    | Customer | Product | DateTime | City |
    +----------+---------------+----------------------+------+
    | 1 | Fortnite | 2018-10-29 11:18:54 | AL |
    | 1 | PUBG | 2018-10-29 11:19:42 | AK |
    | 1 | Overwatch | 2018-10-29 11:19:42 | AZ |
    | 1 | DoTA2 | 2018-10-29 11:19:42 | AR |
    | 1 | CS:GO | 2018-10-29 11:19:43 | CA |
    | 1 | Rocket league | 2018-10-29 11:19:44 | CO |
    | 1 | PUBG | 2018-10-29 11:19:46 | AR |
    | 1 | Borderlands2 | 2018-10-29 11:19:46 | CT |
    | 1 | CS:GO | 2018-10-29 11:19:47 | CA |
    | 1 | Borderlands2 | 2018-10-29 11:19:47. | CT |
    | 1 | Path of exile | 2018-10-29 11:19:51 | CT |
    | 1 | Path of exile | 2018-10-29 11:19:53 | CT |
    | 1 | Hearthstone | 2018-10-29 11:19:56 | CT |
    | 1 | Hearthstone | 2018-10-29 11:19:57 | DE |
    | 1 | Wonderputt | 2018-10-29 11:19:57 | CT |
    +----------+---------------+----------------------+------+





    I used this code and got the answer below



    SELECT  Customer, Product, DateTime, City

    ,COUNT(*) OVER (PARTITION BY Customer, DateTime + INTERVAL '1' SECOND) AS #ofOrders_per_1sec


    ,DENSE_RANK() OVER (PARTITION BY Customer,
    EXTRACT(DAY FROM DateTime),
    EXTRACT(HOUR FROM DateTime),
    EXTRACT(MINUTE FROM DateTime),
    EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND)
    ORDER BY Product ASC)
    + DENSE_RANK() OVER (PARTITION BY Customer,
    EXTRACT(DAY FROM DateTime),
    EXTRACT(HOUR FROM DateTime),
    EXTRACT(MINUTE FROM DateTime),
    EXTRACT(MINUTE FROM DateTime),
    EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND) ORDER BY Product DESC) - 1
    AS Unique_Products_per_1sec

    ,DENSE_RANK() OVER (PARTITION BY Customer,
    EXTRACT(DAY FROM DateTime),
    EXTRACT(HOUR FROM DateTime),
    EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE)
    ORDER BY Product ASC)
    + DENSE_RANK() OVER (PARTITION BY Customer,
    EXTRACT(DAY FROM DateTime),
    EXTRACT(HOUR FROM DateTime),
    EXTRACT(MINUTE FROM DateTime),
    EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE) ORDER BY Product DESC) - 1
    AS Unique_Products_per_1min

    ,DENSE_RANK() OVER (PARTITION BY Customer,
    EXTRACT(DAY FROM DateTime),
    EXTRACT(HOUR FROM DateTime),
    EXTRACT(MINUTE FROM DateTime),
    EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND)
    ORDER BY City ASC)
    + DENSE_RANK() OVER (PARTITION BY Customer,
    EXTRACT(DAY FROM DateTime),
    EXTRACT(HOUR FROM DateTime),
    EXTRACT(MINUTE FROM DateTime),
    EXTRACT(MINUTE FROM DateTime),
    EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND) ORDER BY City DESC) - 1
    AS Unique_City_per_1sec

    ,DENSE_RANK() OVER (PARTITION BY Customer,
    EXTRACT(DAY FROM DateTime),
    EXTRACT(HOUR FROM DateTime),
    EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE)
    ORDER BY City ASC)
    + DENSE_RANK() OVER (PARTITION BY Customer,
    EXTRACT(DAY FROM DateTime),
    EXTRACT(HOUR FROM DateTime),
    EXTRACT(MINUTE FROM DateTime),
    EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE) ORDER BY City DESC) - 1
    AS Unique_City_per_1min
    FROM Dataset


    Result from the code above
    Current result output



    However, I would expect the results below:
    Ideally, to count the transactions in relative terms instead of using 'cardinal' or absolute time xtract from the datetime field.



    Desired result output
    Desired result output










    share|improve this question



























      0












      0








      0







      There is a hypothetical database that records millions of customer transactions per day.

      Aim is to identify unique patterns in the transactions i.e. count unique orders in relative time frames per second, minute, per hour, etc. as well as unique orders per locations.

      There are a number of other variables but I have provided this extract to keep it simple.



      So, basically, I would like to count in relative time frames rather than the 'cardinal' time extract. I'm not sure how to do that. I have searched the different forums but can't work out how to do this in Teradata sql.



      I would really appreciate any help with this!



      Thanks in advance



      Example dataset






      +----------+---------------+----------------------+------+
      | Customer | Product | DateTime | City |
      +----------+---------------+----------------------+------+
      | 1 | Fortnite | 2018-10-29 11:18:54 | AL |
      | 1 | PUBG | 2018-10-29 11:19:42 | AK |
      | 1 | Overwatch | 2018-10-29 11:19:42 | AZ |
      | 1 | DoTA2 | 2018-10-29 11:19:42 | AR |
      | 1 | CS:GO | 2018-10-29 11:19:43 | CA |
      | 1 | Rocket league | 2018-10-29 11:19:44 | CO |
      | 1 | PUBG | 2018-10-29 11:19:46 | AR |
      | 1 | Borderlands2 | 2018-10-29 11:19:46 | CT |
      | 1 | CS:GO | 2018-10-29 11:19:47 | CA |
      | 1 | Borderlands2 | 2018-10-29 11:19:47. | CT |
      | 1 | Path of exile | 2018-10-29 11:19:51 | CT |
      | 1 | Path of exile | 2018-10-29 11:19:53 | CT |
      | 1 | Hearthstone | 2018-10-29 11:19:56 | CT |
      | 1 | Hearthstone | 2018-10-29 11:19:57 | DE |
      | 1 | Wonderputt | 2018-10-29 11:19:57 | CT |
      +----------+---------------+----------------------+------+





      I used this code and got the answer below



      SELECT  Customer, Product, DateTime, City

      ,COUNT(*) OVER (PARTITION BY Customer, DateTime + INTERVAL '1' SECOND) AS #ofOrders_per_1sec


      ,DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND)
      ORDER BY Product ASC)
      + DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND) ORDER BY Product DESC) - 1
      AS Unique_Products_per_1sec

      ,DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE)
      ORDER BY Product ASC)
      + DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE) ORDER BY Product DESC) - 1
      AS Unique_Products_per_1min

      ,DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND)
      ORDER BY City ASC)
      + DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND) ORDER BY City DESC) - 1
      AS Unique_City_per_1sec

      ,DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE)
      ORDER BY City ASC)
      + DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE) ORDER BY City DESC) - 1
      AS Unique_City_per_1min
      FROM Dataset


      Result from the code above
      Current result output



      However, I would expect the results below:
      Ideally, to count the transactions in relative terms instead of using 'cardinal' or absolute time xtract from the datetime field.



      Desired result output
      Desired result output










      share|improve this question















      There is a hypothetical database that records millions of customer transactions per day.

      Aim is to identify unique patterns in the transactions i.e. count unique orders in relative time frames per second, minute, per hour, etc. as well as unique orders per locations.

      There are a number of other variables but I have provided this extract to keep it simple.



      So, basically, I would like to count in relative time frames rather than the 'cardinal' time extract. I'm not sure how to do that. I have searched the different forums but can't work out how to do this in Teradata sql.



      I would really appreciate any help with this!



      Thanks in advance



      Example dataset






      +----------+---------------+----------------------+------+
      | Customer | Product | DateTime | City |
      +----------+---------------+----------------------+------+
      | 1 | Fortnite | 2018-10-29 11:18:54 | AL |
      | 1 | PUBG | 2018-10-29 11:19:42 | AK |
      | 1 | Overwatch | 2018-10-29 11:19:42 | AZ |
      | 1 | DoTA2 | 2018-10-29 11:19:42 | AR |
      | 1 | CS:GO | 2018-10-29 11:19:43 | CA |
      | 1 | Rocket league | 2018-10-29 11:19:44 | CO |
      | 1 | PUBG | 2018-10-29 11:19:46 | AR |
      | 1 | Borderlands2 | 2018-10-29 11:19:46 | CT |
      | 1 | CS:GO | 2018-10-29 11:19:47 | CA |
      | 1 | Borderlands2 | 2018-10-29 11:19:47. | CT |
      | 1 | Path of exile | 2018-10-29 11:19:51 | CT |
      | 1 | Path of exile | 2018-10-29 11:19:53 | CT |
      | 1 | Hearthstone | 2018-10-29 11:19:56 | CT |
      | 1 | Hearthstone | 2018-10-29 11:19:57 | DE |
      | 1 | Wonderputt | 2018-10-29 11:19:57 | CT |
      +----------+---------------+----------------------+------+





      I used this code and got the answer below



      SELECT  Customer, Product, DateTime, City

      ,COUNT(*) OVER (PARTITION BY Customer, DateTime + INTERVAL '1' SECOND) AS #ofOrders_per_1sec


      ,DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND)
      ORDER BY Product ASC)
      + DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND) ORDER BY Product DESC) - 1
      AS Unique_Products_per_1sec

      ,DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE)
      ORDER BY Product ASC)
      + DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE) ORDER BY Product DESC) - 1
      AS Unique_Products_per_1min

      ,DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND)
      ORDER BY City ASC)
      + DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(SECOND FROM DateTime + INTERVAL '1' SECOND) ORDER BY City DESC) - 1
      AS Unique_City_per_1sec

      ,DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE)
      ORDER BY City ASC)
      + DENSE_RANK() OVER (PARTITION BY Customer,
      EXTRACT(DAY FROM DateTime),
      EXTRACT(HOUR FROM DateTime),
      EXTRACT(MINUTE FROM DateTime),
      EXTRACT(MINUTE FROM DateTime + INTERVAL '1' MINUTE) ORDER BY City DESC) - 1
      AS Unique_City_per_1min
      FROM Dataset


      Result from the code above
      Current result output



      However, I would expect the results below:
      Ideally, to count the transactions in relative terms instead of using 'cardinal' or absolute time xtract from the datetime field.



      Desired result output
      Desired result output






      +----------+---------------+----------------------+------+
      | Customer | Product | DateTime | City |
      +----------+---------------+----------------------+------+
      | 1 | Fortnite | 2018-10-29 11:18:54 | AL |
      | 1 | PUBG | 2018-10-29 11:19:42 | AK |
      | 1 | Overwatch | 2018-10-29 11:19:42 | AZ |
      | 1 | DoTA2 | 2018-10-29 11:19:42 | AR |
      | 1 | CS:GO | 2018-10-29 11:19:43 | CA |
      | 1 | Rocket league | 2018-10-29 11:19:44 | CO |
      | 1 | PUBG | 2018-10-29 11:19:46 | AR |
      | 1 | Borderlands2 | 2018-10-29 11:19:46 | CT |
      | 1 | CS:GO | 2018-10-29 11:19:47 | CA |
      | 1 | Borderlands2 | 2018-10-29 11:19:47. | CT |
      | 1 | Path of exile | 2018-10-29 11:19:51 | CT |
      | 1 | Path of exile | 2018-10-29 11:19:53 | CT |
      | 1 | Hearthstone | 2018-10-29 11:19:56 | CT |
      | 1 | Hearthstone | 2018-10-29 11:19:57 | DE |
      | 1 | Wonderputt | 2018-10-29 11:19:57 | CT |
      +----------+---------------+----------------------+------+





      +----------+---------------+----------------------+------+
      | Customer | Product | DateTime | City |
      +----------+---------------+----------------------+------+
      | 1 | Fortnite | 2018-10-29 11:18:54 | AL |
      | 1 | PUBG | 2018-10-29 11:19:42 | AK |
      | 1 | Overwatch | 2018-10-29 11:19:42 | AZ |
      | 1 | DoTA2 | 2018-10-29 11:19:42 | AR |
      | 1 | CS:GO | 2018-10-29 11:19:43 | CA |
      | 1 | Rocket league | 2018-10-29 11:19:44 | CO |
      | 1 | PUBG | 2018-10-29 11:19:46 | AR |
      | 1 | Borderlands2 | 2018-10-29 11:19:46 | CT |
      | 1 | CS:GO | 2018-10-29 11:19:47 | CA |
      | 1 | Borderlands2 | 2018-10-29 11:19:47. | CT |
      | 1 | Path of exile | 2018-10-29 11:19:51 | CT |
      | 1 | Path of exile | 2018-10-29 11:19:53 | CT |
      | 1 | Hearthstone | 2018-10-29 11:19:56 | CT |
      | 1 | Hearthstone | 2018-10-29 11:19:57 | DE |
      | 1 | Wonderputt | 2018-10-29 11:19:57 | CT |
      +----------+---------------+----------------------+------+






      sql teradata






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 28 '18 at 10:18









      dnoeth

      44.9k31838




      44.9k31838










      asked Dec 28 '18 at 9:19









      EzenwaEzenwa

      13




      13
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53956154%2fhow-can-i-count-unique-orders-from-unique-locations-in-teradata-in-relative-time%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53956154%2fhow-can-i-count-unique-orders-from-unique-locations-in-teradata-in-relative-time%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Mossoró

          Error while reading .h5 file using the rhdf5 package in R

          Pushsharp Apns notification error: 'InvalidToken'