title: order analytical functions not allowed in where clause
body: <p>I am trying to achieve the below but facing error like order analytical functions not allowed in where clause</p>
  
  <pre><code>select  a.araccno,a.ARBDTE,
  sum(aramt) over( partition by araccno,ARBDTE  ORDER BY ARAMT asc) sum1
  ,sum(b.Bill_Stmt_Discount_Amt) over( partition by b.bill_statement_id order by b.Bill_Stmt_Discount_Amt asc) sum2
  from stg.ars_etl  a
  left outer join  tgt.bill_sta_dis  b
  on 'LL'||a.araccno||a.arbdte=b.bill_statement_id
  where  sum1&lt;&gt; sum2
  </code></pre>
  
  <p>How can i achieve this in Teradata?</p>
  
  <p>Thanks a lot!!</p>