![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Being a Friday I can't seem to think. My brain has left for the weekend, so I ask the group: I have a file with customer orders, how would I get a list of customers who have not placed an order in the last three years? |
#3
| |||
| |||
|
|
On 24/06/2011 6:54 p.m., ck wrote: Being a Friday I can't seem to think. My brain has left for the weekend, so I ask the group: I have a file with customer orders, how would I get a list of customers who have not placed an order in the last three years? |
|
You would need to do something like: SELECT the orders file for orders in the last three years The objective here is to get a select list of the customer ids who have ordered. Then: NSELECT the customers file. |
#4
| |||
| |||
|
|
OP didn't mention which O/S, so NSELECT might not be available. Here's a "vanilla" eqivalent, written for uniData: .. SAVING UNIQUE CUSTOMER.ID UPDATE TEMP.CUST [ENTER] 1 [ENTER] 1 [ENTER] |

#5
| |||
| |||
|
|
OP didn't mention which O/S, so NSELECT might not be available. Here's a "vanilla" eqivalent, written for uniData: .. SAVING UNIQUE CUSTOMER.ID UPDATE TEMP.CUST [ENTER] 1 [ENTER] 1 [ENTER] On 6/24/11 3:26 PM, Tony Gravagno wrote: Since when is that syntax "vanilla"? ![]() |
#6
| |||
| |||
|
|
OP didn't mention which O/S, so NSELECT might not be available. Here's a "vanilla" eqivalent, written for uniData: .. SAVING UNIQUE CUSTOMER.ID UPDATE TEMP.CUST [ENTER] 1 [ENTER] 1 [ENTER] Since when is that syntax "vanilla"? ![]() |
#7
| |||||
| |||||
|
|
Being a Friday I can't seem to think. My brain has left for the weekend, so I ask the group: I have a file with customer orders, how would I get a list of customers who have not placed an order in the last three years? |
|
SL SUB1 |
|
QSELECT REG.SUBSCRIPTION (4 |
|
SL SUB2 |
|
SL SUB2 |
#8
| |||
| |||
|
|
I just took a shot at this in D3, not wanting to create a temp file that included complete records. (Comments are in parentheses) (Get all subscribers = customers) :SELECT REG.SUBSCRIBER [404] 48 items selected out of 48 items. (Save the list of everyone) SL SUB1 List 'SUB1' in file 'pointer-file' saved. (Get recent transactions = orders) :SELECT REG.SUBSCRIPTION WITH DATE > 05/15 [404] 43 items selected out of 89 items. (Within those items, extract the subscriber ID) QSELECT REG.SUBSCRIPTION (4 [404] 43 items selected out of 43 items. (Save recently referenced subscriber/customer IDs) SL SUB2 List 'SUB2' in file 'pointer-file' saved. (GL is shortcut for GET-LIST, note Unique option) :GL SUB2 (U pointer-file 'SUB3' size = 228 (Re-save the now shorter list, SL=SAVE-LIST) SL SUB2 List 'SUB2' in file 'pointer-file' saved. (Helpful list operation) :COMPARE-LIST SUB1 - SUB2 SUB3 (Final list is in SUB3, sort it) :SORT-LIST SUB3 (Edit-list, now has 31 items) :EL SUB3 With the above, and other suggestions in this thread, someone can quickly create a cross-platform verb (or wrapper for QSelect) which performs this relatively common data operation. I dunno if non-D3 flavors have REFORMAT, or if is moot point |
#9
| |||
| |||
|
#10
| |||
| |||
|
|
..The above query only gets you a list of customers who have ever actually ordered. To get the ones who haven't... |
![]() |
| Thread Tools | |
| Display Modes | |
| |