Hi Guys,
Is it possible to do a WHILE loop in a SELECT statement?
I am trying to pull a list of customers first successful purchase for a discount offer. can someone help...
DATA
CUSTID ORDERID STATUS
11111 00001 CANCELLED
11111 00002 SUCCESSFUL
22222 00003 SUCCESSFUL
33333 00004 CANCELLED
33333 00005 CANCELLED
33333 00006 SUCCESSFUL
I am doing a rank on CUSTID and ORDERID to get the transactions in order but some people have 2 or 3 cancelled orders before a successful one.
could I do a WHILE loop in the WHERE clause?
Is it possible to do a WHILE loop in a SELECT statement?
I am trying to pull a list of customers first successful purchase for a discount offer. can someone help...
DATA
CUSTID ORDERID STATUS
11111 00001 CANCELLED
11111 00002 SUCCESSFUL
22222 00003 SUCCESSFUL
33333 00004 CANCELLED
33333 00005 CANCELLED
33333 00006 SUCCESSFUL
I am doing a rank on CUSTID and ORDERID to get the transactions in order but some people have 2 or 3 cancelled orders before a successful one.
could I do a WHILE loop in the WHERE clause?