sql - Identifying Unique Visits by Customer -


I am working in SQL Server and I have a table of custom ID, visitor, sales and quantity. I am trying to calculate, so how much does the customer buy on his first repeat purchase, second repeat purchase etc. Apart from this, how much time passes between each purchase.

Any guidance will be helpful, thanks!

You Row_number () and conditional integration. Here is an example:

  select average, average (sales) as avgales, in case of maximum (case when segnum = 1 sales end) sales_01, maximum (in case when segnum = 2 sales end) as sale_02, max (in case of segnum from the table) by salesdesign (by salesdesign) by salesd3 (select t. *, Row_number () by the visitdate) T group;  

By the way, your question should include sample data, the desired result and table layout,


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -