earthandfire
Programmer
SalesTable
includes the following fields:
[tt] SalesDate datetime
Customer int
OrderNumber int
NewCustomer bit
[/tt]
The requirement is to set the NewCustomer field to 1 where this is the first sale to a customer for 4 years (or this is a brand new customer)
The table contains all sales data since the late 1990s
Any help would be gratefully appreciated - I've been going round in circles with this since Friday morning.
Unfortunately this is required as a query, not a stored procedure, which is one reason why I am struggling.
![[vampire] [vampire] [vampire]](/data/assets/smilies/vampire.gif)
![[bat] [bat] [bat]](/data/assets/smilies/bat.gif)
includes the following fields:
[tt] SalesDate datetime
Customer int
OrderNumber int
NewCustomer bit
[/tt]
The requirement is to set the NewCustomer field to 1 where this is the first sale to a customer for 4 years (or this is a brand new customer)
The table contains all sales data since the late 1990s
Any help would be gratefully appreciated - I've been going round in circles with this since Friday morning.
Unfortunately this is required as a query, not a stored procedure, which is one reason why I am struggling.
![[vampire] [vampire] [vampire]](/data/assets/smilies/vampire.gif)
![[bat] [bat] [bat]](/data/assets/smilies/bat.gif)