Skip to Content
avatar image
Former Member

Customer categorisation query

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Nov 03, 2015 at 12:38 PM

    HI

    I didn't understand what you need

    can you explain what you need in your query?

    shachar

    Add comment
    10|10000 characters needed characters exceeded