Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3180

Customer categorisation query

$
0
0

Hi

 

Putting it out to the helpful experts again.

 

Trying to categorise customers by certain purchase combinations. Difficulty being that i'm having to rely on item description to ensure all data is captured and so am using the "contains" condition.

 

Categories i'm trying to cover are as follows,

 

  • Group 1: Product type A/ Product type B/ Product type C, Product Type D), Product type E), Product Type F
  • Group 2: Product type A/ Product type B/ Product type C, Product Type D), Product type E),
  • Group 3: Product type A/ Product type B/ Product type C, Product Type D),
  • Group 4: Product type A/ Product type B/ Product type C
  • Group 5: Product type A/ Product type B/

 

EG Group one contains only active BPs that purchase A&B&C&D&E&F

Group two contains only active BPs that purchase A&B&C&D&E

 

and so on.

 

Initial query is here but am running into issues going beyond the one product type.

 

SELECT count(distinct T0.[CardCode]) [No Of Customers]

FROM OINV T0  INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry]

WHERE T1.[Dscription] Like '%%[%0]%%' and cast(T1.DocDate as date) >= dateadd(dd, -180, cast(getdate() as date))

 

Many thanks in advance for any advice!


Viewing all articles
Browse latest Browse all 3180

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>