1 Reply Latest reply: May 2, 2017 12:55 PM by m w RSS

    Using peek similar function in SQL

    Mark Graham

      Order_id

      Customer_id

      Order_date

      Product_id

      Quantity (Units)

      O1

      C1

      01-Jan-2000

      P1

      10

      O2

      C2

      01-Jan-2002

      P2

      15

      O3

      C3

      01-Apr-2002

      P3

      17

      O4

      C4

      01-Apr-2003

      P1

      20

      O5

      C4

      01-Jan-2006

      P2

      1

      O6

      C1

      01-May-2006

      P5

      7

       

      In SQL,

      I'm trying to generate the list of customers whose total ordered units is consistently lesser than the previous order. As in Total Qty purchased in the nth order is less than Total Qty purchased in n-1 th order.


      Can someone please help?

      Normallty, I would sum the units group by and order by Customer_id  and see the peek of data in Qlikview.

      Cna somone please help with SQL?