-1

I am trying to create a count column when the same customer contacts regarding an item ("attached_to col" below).

Attempt below shows the total count, but is not a counter. I would like it to show as a counter by date as per screenshot

select
    concat(Customer,'-',attached_to) as MergedID,
    Customer,
    record,
    purchasedate,
    attached_to,
    COUNT(MergedID) OVER (PARTITION BY MergedID) AS Count
from 
    table 1

screenshot

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
msulol
  • 67
  • 6

1 Answers1

0

nvm found answer, all good.

select
concat(Customer,'-',attached_to) as MergedID,
Customer,
record,
purchasedate,
attached_to,
row_number() OVER (PARTITION BY MergedID order by purchase date) AS Count
from table 1
msulol
  • 67
  • 6